How do i get a standard amount of articles per page?
I have this code which pulls a list of articles from my database.
<?php $query = "SELECT pictures,brands,title,description,oldprice,newprice FROM images";
$result = mysql_query($query) or die ("can't enter into DATABASE!");
while($rij = mysql_fetch_array($result)){
$pics = $rij["pictures"];
echo "<p><img src=\"$pics\" /></p>"." <h3>
| ".$rij['merken']." |</h3> ".$rij['title']." | ".$rij['description']." | <b>old price:</b&g开发者_如何学JAVAt; €".$rij['oldprice']."
| <b>new price:</b> €".$rij['newprice']."<hr/><br/>";
}
?>
Now this script is displaying all 10 articles in my database on one page. But what i want to achieve is to display a maximum of 5 articles per page. So 50 articles should result into 10 pages.
Look at OFFSET and LIMIT for MySQL:
See: http://www.petefreitag.com/item/451.cfm
精彩评论