Forum Moderators: coopster
Can anyone help plz
<?
require('config.php');
$name ="Holidays";
mysql_connect($dhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM details WHERE maindir = '$name'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$name2=mysql_result($result,$i,"maindir");
$photoa=mysql_result($result,$i,"maincont");
$path2 ="$name/$photoa";
echo '<table cols="2" border="0" cellpadding="10" cellspacing="0" align="center" width="100%">';
print "<td><a href=\"$path" . $path2 . "\"><img src=\"$path" . $path2 . "\" width=129 height=160><td><tr>";
echo "</td></tr>
$i++;
}
Thanx Everyone
echo "</table>";
?>
<table>
<?php
$counter=0;
?>
<tr>
<?php
do {
echo ('<td class="tdroster">');
echo ('<div align="center">');
echo '<a href="roster_detail.php?id='.$row_diesel_records['id'].'"><img src="'.$row_diesel_records['rosterpath'].'" alt="'.$row_diesel_records['name'].'" /><br />';
echo $row_diesel_records['name'];
echo "</a>";
echo "</div>";
echo '<p class="rostertext">';
echo $row_diesel_records['short_desc'];
echo "</p>";
echo "</td>";
if ($counter==1) { //THIS IS FOR A TWO-COLUMN LAYOUT - CHANGE TO 2 for THREE-COLUMN LAYOUT
echo "</tr><tr>";
$counter=0;
} else {
$counter++;
}
}
while ($row_diesel_records = mysqli_fetch_assoc($diesel_records));
// evaluate whether the dataset has an odd or even number of rows via bitwise eval - CHANGE TO SUIT YOUR NEED
if (1 & $totalRows_diesel_records) {
echo "</tr>";
} else {
echo "<td></td></tr>";
}
?>
</table>
The BITWISE EVALUATION is used to properly close the opened TABLE (HTML table). Most sites I work with insist that their pages validated against W3C.
Let me Know how It works Out...