I have created a sidebar that is supposed to show the titles of the latest 8 stories. I however have the premonition that the sidebar will only display the titles of rows 0 to 8 instead of displaying the last eight regardless of row number. Below is the php code that I wrote for displaying the titles with the code in red triggering my premonition. Will the LIMIT statement really work to achieve my objective?
Code:
<?php
// Include database connection settings
include('config.inc');
$result = mysql_query("SELECT * FROM stories order by datetime ASC limit 0,8");
while($row = mysql_fetch_assoc($result))
{
$id=$row['id'];
echo '<h3><a href="stories.php?id='.$id.'">' .$row['title'] . '</a></h3>';
echo 'By ' . $row['names'] . '';
}
?>
Again I ask, will the limit statement only select the last eight or the rows 0 to 8?