Hey Justin. When you're working with SQL, any limiting becomes part of your query. Take the following example:
Code: Select all
$myDemoQuery = "SELECT * FROM myinfotable LIMIT 5";
$result = mysql_query($myDemoQuery) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
echo $row["somecolumn"];
}
You can see how I shoved the LIMIT clause in there. You can read more about working with LIMIT's here:
http://dev.mysql.com/doc/refman/5.0/en/select.html
About a third of the way down that page there's a bit that reads:
The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be non-negative integer constants (except when using prepared statements).
That's the part you're interested in. Hope that helps!