Displaying 5 records only/displaying specific records

From: Date: Tue, 03 Jun 2003 13:21:06 +0000
Subject: Displaying 5 records only/displaying specific records
Groups: php.general 
Request: Send a blank email to php-general+get-149955@lists.php.net to get a copy of this message
Hi, 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";
                             $resGubbins = mysql_query($gubbins,$conn);
               $rowsGubbins = mysql_fetch_assoc($resGubbins);
                                               echo "<p>&nbsp;</p>\n";
               echo "<table cellpadding=3 cellspacing=0 border=0><tr><td width=75>\n";
               echo "<img src=\"/i/s/";
               //echo pageImage
                             echo "\" width=\"75\"/>\n";
               echo "</td><td width=\"225\">";
               // echo pageTitle
                             // echo pageContent
              
               echo "</td></tr>\n";
              
//Begin Loop articles 2-5 // Not sure how to make the loop start at the 2nd record
                                                       echo "<tr><td>&nbsp;</td>\n";
               echo "<td><p><strong>";
               //echo pageTitle
               echo "</strong> ";
               // echo pageContent
               echo "<a href=\"/news/page.php?pageID=";
               //echo page ID
               echo "\">Read More...</a></p></td></tr>\n";
                             //end loop
               }*/
               echo "</table>\n";
} ?> I can see in my head how this should work but I' don't really understand how to do things like print the value of pageTitle for the nth record in the set. Any pointers would be gratefully received. Matt

« previous php.general (#149955) next »