问题描述:

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> ".$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.

网友答案:

To make it short, read this link and you'll see how to do that :)

网友答案:

Look at OFFSET and LIMIT for MySQL:

See: http://www.petefreitag.com/item/451.cfm

相关阅读:
Top