[PHP] news site, recent entries retrieval

2002-11-13 Thread Pag

	Hi,

	I am writing a back end to be used by general news and journal sites and i 
am running into some problems.
	I already did all the background work, created the tables, programmed a 
php news manager to add, edit, remove entries/comments, etc. The problem is 
displaying all the info on the site. Whats the mysql command to display 
only n entries? I mean, assume i want to display only the 10 most recent 
entries on the main page, how do i do that? :-P
	One of the fields in my tables is type (values 0, 1, 2 etc), which 
divides the news into categories, how can i display like the 10 most recent 
entries of type = 2, for example?
	I am lost, could really use some help. Thanks!

	Pag



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] news site, recent entries retrieval

2002-11-13 Thread Chris Hewitt
Pag wrote:


One of the fields in my tables is type (values 0, 1, 2 etc), 
which divides the news into categories, how can i display like the 10 
most recent entries of type = 2, for example?

If your table is called mynews and it has a field called timestamp which 
contains the date/time the entry was made and you wanted the 10 most 
recent items of type 2, most recent first:

select * from mynews where type = 2 limit 10 order by timestamp desc;

Untested, but I think the syntax for MySQL is correct. Check in the 
MySQL manual if its not. Really a mysql list question.

HTH
Chris



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php