I use a function for database tables, as they are always different number of columns or rows.
once you've done you query call
DrawResult($result);
add this somewhere:
///////////////////////////////////////////////////////////////////////////////
function DrawResult($my_result){
$columns=@mysql_num_fields($my_result);
// figure out how many columns are in it and do the table to fit.
echo "<table align=\"center\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" width=\"98%\">\n";
$row=0;
// display field names
// print "<th>row</th>";
// for ($i = 0; $i < mysql_num_fields($my_result); $i++) {
// print "<th>".mysql_field_name($my_result,$i)."</th>\n";
// }
while ($myrow = mysql_fetch_array($my_result)){
// start the results display table
$row++;
if($row%2){
$color="#ECECEC";
}else{
$color="#D1DEFD";
}
echo "<tr><td width=20>$row</td>";
for ($i = 0; $i < ($columns); $i++) {
echo "<td bgcolor=\"$color\"> $myrow[$i] </td>\n";
}
echo "</tr>\n";
}
mysql_free_result($my_result);
echo "</table>\n";
}
______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.