Can anyone help me with formatting my results? I would like each result to have a different table color... Like the results in this forum...
Here is the code without any formatting...:
any ideas?:
<?php
// create connection
$connection = mysql_connect("localhost","user","pass")
or die("Couldn't make connection.");
// select database
$db = mysql_select_db("user", $connection)
or die("Couldn't select database.");
// create SQL statement
$sql = "SELECT comments
FROM shows
ORDER BY comments DESC";
// execute SQL query and get result
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query.");
// start results formatting
echo "<TABLE BORDER=0>";
//this is the area in question
while ($row = mysql_fetch_array($sql_result)) {
$comments = $row["comments"];
echo "<TR>
<TD><div align=\"center\">$comments</div><hr width=\"80%\" noshade size=\"1\"></TD>
</TR>
";
}
echo "</TABLE>";
// free resources and close connection
mysql_free_result($sql_result);
mysql_close($connection);
?>
Thanks in advance...