Re: < Previous and Next > Buttons
| From: | J.Veenhuijsen | Date: | Mon, 17 Feb 2003 15:09:48 +0000 |
| Subject: | Re: < Previous and Next > Buttons | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-18566@lists.php.net to get a copy of this message | ||
I once used the script below on a dbase database.
Jochem
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
</head>
<body>
<script language="PHP">
$step=30;
$file_name='dbs/files.DBF';
$ret=dbase_open($file_name,0);
$max=dbase_numrecords($ret);
if (isset($start))
{
$start_record=$start;
}
$arr = dbase_get_record_with_names($ret,$i);
echo($file_name);</script> <div align="left"> <table border="0" width="1500" height="17">
<tr>
<td width="150" height="17" bgcolor="#FFCC00"><font face="Verdana" size="1"><b>RECNO</b></font></td>
<script language="PHP">
while (list($key,$val) = each ($arr))
{
</script>
<td width="150" height="17" bgcolor="#FFCC00"><font face="Verdana" size="1"><b><?php echo (strtoupper($key)) ?></b></font></td><script language="PHP">
}
</script>
</tr><script language="PHP">
for ($i=$start_record;$i<=$start_record+$step;$i++)
{
$arr = dbase_get_record_with_names($ret,$i);
</script>
<tr>
<td width="150" height="17"><font face="Verdana" size="1"><?php echo($i); ?></font></td>
<script language="PHP">
while (list($key,$val) = each ($arr))
{
</script>
<td width="150" height="17"><font face="Verdana" size="1"><?php echo($val) ?></font></td><script language="PHP">
}</script>
</tr><script language="PHP">
}</script> </table> </div> <script language="PHP"> $next_start_record=$start_record+$step; if ($next_start_record+$step>$max) { $next_start_record=$max-$step; } $prev_start_record=$start_record-$step; if ($prev_start_record<0) { $prev_start_record=0; } </script> <p><font face="Verdana" size="2"><b><a href="<?php echo($PHP_SELF);?>?start=<?php echo($prev_start_record) ?>">PREV</a> <a href="<?php echo($PHP_SELF);?>?start=<?php echo($next_start_record) ?>">NEXT</a> </b></font></p> </body> </html> Matt Babineau wrote:
Hi All- I was wondering what the best way to create previous and next buttons when pulling products from a database? I haven't had much luck so far and was wondering if someone had an easy / efficient way to accomplish this? Thx- M