reverse array for mysql data
| From: | ktb | Date: | Mon, 30 Apr 2001 18:51:46 +0000 |
| Subject: | reverse array for mysql data | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-51044@lists.php.net to get a copy of this message | ||
I'm new at programing and not getting very far with this. I've looked
at "array_revers" and "array_multisort" and can't get anything to work.
What I have is a mysql table laid out like:
item number | title | body text | subject heading
What I want to do is pull the top 7 entries off and display them on a
web page. I have written some code that will do this but when it prints
to the web page the first item is printed at the top and I would like it
on the bottom with later entries successively on top. How can I do
this? Hear is the code I have so far:
$result = mysql_query ("SELECT title, body FROM junkyard LIMIT 0, 7");
$i = '0';
while ($i < 7) {
if ($row = mysql_fetch_array ($result)) {
echo "$row[0] <br />$row[1]";
++$i;
}
}
Thanks,
kent