RE: [PHP-GENERAL] PHP Newbie needing a little help: Display only most recent database entries?
| From: | Sam Masiello | Date: | Thu, 15 Jun 2000 16:37:19 +0000 |
| Subject: | RE: [PHP-GENERAL] PHP Newbie needing a little help: Display only most recent database entries? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1960@lists.php.net to get a copy of this message | ||
What you can do is when you select the information that you want to pull
from the table, affix and "order by" clause at the end of your select
statement based on your date. Like the following:
SELECT ... ... ...
FROM table1
WHERE ..
AND ...
...
...
ORDER BY date DESC LIMIT 5 ;
This will give you the 5 most recent entries in your table based on the
date. If you don't want to limit to any certain number of entries, then do
not use "LIMIT 5."
Sam Masiello
System Analyst
Chek.Com
(716) 853-1362 x289
smasiello@chekinc.com
-----Original Message-----
From: James Montz [mailto:jmontz@ncn.net]
Sent: Thursday, June 15, 2000 12:39 PM
To: php-general@lists.php.net
Subject: [PHP-GENERAL] PHP Newbie needing a little help: Display only most
recent database entries?
I have a very simple little program to post data to a database, and a page
to view the data in the data.
Could someone give me an example on how to show just the most recent X
number of entries in the database? All my database records have an ID and
Date stamp.
Thank you,
____________________
James C. Montz
Systems Engineer
Northwest Internet Services
"A complex system that does not work is invariably found to have evolved
from a simpler system that worked just fine. "
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net