I have a site I'm converting to PHP andMySQL. The problem I have is
this:
I want to display news items (it's a hardware news site)
starting with the newest entries in the database (at the end of the database) and the 5 or 10
behind it. From the top of the page to the bottom. I cannot figure out
how to pull from the end of the database without knowing the numbers
or how to display from top to bottom. Here is the code I'm currently
using to display the first ten:
<?php
$count = 0;
$news=9;
$dt = date("m-d-Y H:i:s (T)");
$db = mysql_connect ("localhost", "username", "password")
or die (errmailer());
mysql_select_db ("my_database", $db);
$result = mysql_query("SELECT * FROM ARTICLES ORDER BY ARTICLEID",$db);
if ($result)
{
$numfields = mysql_num_fields($result);
while (($row = mysql_fetch_row($result)) && ($count!=$news))
{
?>
<A HREF="?page=articles#a<? print($row[0]); ?>" class="roll"> <? print(ucwords($row[1]));?><BR><hr width="10%" align="center" noshade color="#666666" size="1"><?
$count++;
}
} else
{
print ("There Was An Error! Code: '$result'<br>");
}
?><A HREF="?page=articles#a<? print($row[0]); ?>" class="roll"><? print(ucwords($row[1]));?><BR><BR><?
mysql_close ($db);
?>
Any help? I'm totally lost.
Matt