PHP table order from MYSQL
Posted: Tue Jul 10, 2007 10:37 pm
I want to view the tables in descending order, how do I do that here?
http://www.bensphotosite.com/home/index.php
Here's my code
http://www.bensphotosite.com/home/index.php
Here's my code
Code: Select all
mysql_select_db("news", $con);
$result = mysql_query("SELECT * FROM news");
while($row = mysql_fetch_array($result))
//if($row['cat'] = News)
{
if ( $row['cat'] == News){
echo " <table bgcolor=\"#F0F1FF\" width=\"500\" height=\"100\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: 1px solid #B3C0FF; margin: 10px; padding: 0;\" >
<tr>
<td valign=\"top\" height=\"15\" style=\"padding: 3px 3px 3px 5px ; border-bottom: 1px solid #B3C0FF\">
<d1head> News: " . $row['title'] . "</d1head>
</td>
</tr>
<tr>
<td valign=\"top\" height=\"20\" style=\"padding: 10px\"
<t2>" . $row['news'] . "</t2><t2><br />
<br /> " . $row['name'] . "</t2>
</td>
</tr>
<tr>
<td valign=\"top\" height=\"20\" style=\"border-top: 1px solid #B3C0FF\">
<t2>" . $row['date'] . "</t2>
</td>
</tr>
</table>
";
}
else{
echo " <table bgcolor=\"#F0F1FF\" width=\"500\" height=\"100\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: 1px solid #B3C0FF; margin: 10px; padding: 0;\" >
<tr>
<td valign=\"top\" height=\"15\" style=\"padding: 3px 3px 3px 5px ; border-bottom: 1px solid #B3C0FF\">
<d1head> Blog: " . $row['title'] . "</d1head>
</td>
</tr>
<tr>
<td valign=\"top\" height=\"20\" style=\"padding: 10px\"
<t2>" . $row['news'] . "</t2><t2><br />
<br /> " . $row['name'] . "</t2>
</td>
</tr>
<tr>
<td valign=\"top\" height=\"20\" style=\"border-top: 1px solid #B3C0FF\">
<t2>" . $row['date'] . "</t2>
</td>
</tr>
</table>
";
}
}