Re: Displaying 5 records only/displaying specific records

From: Date: Tue, 03 Jun 2003 13:30:25 +0000
Subject: Re: Displaying 5 records only/displaying specific records
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-149958@lists.php.net to get a copy of this message
> I'm trying to build a news panel for my home page. Basically I want to > present the five most recent news articles in a recordset, but I'm not > sure how to cut off the recordset after 5. > Also I want to present a picture with my first headline. > > My code will go something like this: > > <?php > // Start News Wotsit. > // Create Recordset > $gubbins = "SELECT * FROM tblContent WHERE pageParent = > 3 ORDER BY pageDate DESC"; SELECT * FROM tblContent WHERE pageParent = 3 ORDER BY pageDate DESC LIMIT 5 Now your result only has 5 results returned. Loop through them with mysql_fetch_assoc() and display accordingly. ---John Holmes...

« previous php.general (#149958) next »