05-24-2012, 03:51 PM
|
#1 (permalink)
|
|
The Wanderer
Join Date: May 2012
Posts: 6
Thanks: 2
|
Re-order display of data-base
I have a table on my site of names and comments that is pulled from a sql data-base. Works perfect you can add comments aswell.
How would i go about displaying it as the last comment that was posted to be on top rather than at the bottom?
my current code for displaying the table is:
PHP Code:
mysql_connect("$host", "$username", "$password")or die("cannot connect server ");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
?>
<table width="100%" border="0">
<tr>
<td><table width="100%" border="0" bordercolor="#FF0000">
<tr>
<td class="commentsname"><? echo $rows['name']; ?>:</td>
<td class="commentstxt"><? echo $rows['comment']; ?></td>
</tr>
</table></td>
</tr>
</table>
which displays perfect only i want the latest comment on top instead of pusshed down to the bottom  help appriciated
|
|
|
|