Welcome to WebmasterWorld Guest from 54.147.44.93

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP and mySQL search

     

circuitjump

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

10+ Year Member



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

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

10+ Year Member



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>
 

Featured Threads

Hot Threads This Week

Hot Threads This Month