homepage Welcome to WebmasterWorld Guest from 54.167.138.53
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP and mySQL search
circuitjump




msg:1300757
 7:57 pm on Mar 15, 2002 (gmt 0)

What would be the best way to display info from a database by sets of 15 rows per page?
In PHP ofcource.

With a previous and next button.

 

toadhall




msg:1300758
 2:35 am on Mar 16, 2002 (gmt 0)

I don't know which is best, using LIMIT or <= / >=, but here's something you might be able to work with using LIMIT:

<html>
<head>
<title>updown.php</title>
<body>
<?
if ($move == "up") {
$start += 15;
} elseif ($move == "down") {
$start -= 15;
} else {
$start = 0;
}
?>
<p>
SELECT stuff FROM table ORDER BY whatever LIMIT <?echo $start;?>,15
</p>
<table cellpadding=6><tr>
<td>
<form method=post action="updown.php">
<input type=hidden name=move value=up>
<input type=hidden name=start value=<?echo ("$start");?>>
<input type=submit value="Next 15">
</form>
</td>
<?
if ($start > 0) {
?>
<td>
<form method=post action="updown.php">
<input type=hidden name=move value=down>
<input type=hidden name=start value=<?echo ("$start");?>>
<input type=submit value="Prev 15">
<?
}
?>
</form>
</td>
</tr></table>
</body>
</html>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved