Hi all,

The following code should select all data, grab the highest value row (i.e. the newest), and display that exact rows number, contained text and time/date of creation.

It is correctly grabbing the row number, but still only grabbing the contents of the first row.

I am not getting any errors at all, just the displayed data is incorrect

<?php 
$dbh=mysql_connect ("-", "-", "-") or die 
('I cannot connect to the database because: ' . mysql_error()); 
mysql_select_db ("silverlink"); 
$rs = mysql_query("SELECT max(post_id), post_text, post_create_time FROM forum_posts ") or die
(mysql_error());
while ( $rows = mysql_fetch_array( $rs) )
{
echo "<p>";
echo $rows['post_text'];
echo "</p>";
echo "<p>";
echo $rows['post_create_time'];
echo "</p>";
echo $rows[0];
}
?>

because u have applied max function thats why it will pic just max(post_id) if you want all the records from latest to old then ur query should be

"SELECT post_id, post_text, post_create_time FROM forum_posts order by post_id desc"

This question has already been answered. Start a new discussion instead.