Search the archives for "previous next links" and you'll see a ton of ways to do this. You are setting the variables to 0 and 5 and then issuing the query. You have to put some logic in there to only set it to those values if it's the first time this page is called. If a $tot or $van value is passed in the URL, then you should use that.
---John Holmes... > -----Original Message----- > From: danny [mailto:[EMAIL PROTECTED]] > Sent: Sunday, September 29, 2002 3:56 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] navigatie doesn't work in this script > > In production this database will be verry big (about 10000 records) and > for > almost every record a MP3 or picture. So i want to show only 5 records at > a > time. Therefore i tried to create a navigation system. And it isn't > working > properly now. (It doesn't go up), i always get the same five records. the > variables $van and $tot have to be the limits ("van" = from and "tot" > means > to) > > John W. Holmes <[EMAIL PROTECTED]> schreef in berichtnieuws > 001401c267ee$e6a510d0$[EMAIL PROTECTED] > > You have LIMIT 0,5 in your query...what do you expect to happen? You're > > only going to get five rows with that in there. > > > > ---John Holmes... > > > > > -----Original Message----- > > > From: danny [mailto:[EMAIL PROTECTED]] > > > Sent: Sunday, September 29, 2002 3:21 PM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] navigatie doesn't work in this script > > > > > > I made a MySQL database with a dictionary in it. Above there is a form > > in > > > wich you can specify some parameters. The problem is that the > > navigation > > > doesn't work well. I always get the first 5 results. Can somebody help > > me > > > out? There are about 56 records in the database. > > > > > > The (not quite) working thing is on: > > > http://www.oostendseverhalen.be/test_met_navigatie3.php > > > > > > <html> > > > <head> > > > <title>Untitled Document</title> > > > <meta http-equiv="Content-Type" content="text/html; > > charset=iso-8859-1"> > > > </head> > > > > > > <body> > > > > > > <?php > > > > > > /* hieronder volgt het formulier */ > > > echo ' > > > <table width="100%" border="0" align="center" cellpadding="2"> > > > <tr> > > > <td height="198"> <form name="form1" method="post" action=""> > > > <table width="100%" height="89" border="0" align="center" > > > cellpadding="2" summary="interactief woordenboek Oostends nederlands, > > > Engels > > > en Frans."> > > > <caption> > > > <font color="#003399" size="6" face="Tahoma">Ostensche > > > encyclopedie </font> > > > </caption> > > > <tr align="left" valign="middle" bordercolor="#000033" > > > bgcolor="#CCFFFF"> > > > <td width="33%" height="47" align="left" > > > valign="middle"><em><strong><font size="2" face="Tahoma"> > > > <label> > > > <input name="taalkeuze" type="radio" value="woord_ost" > > > checked> > > > Oostends-Drooghenbroodt</label> > > > <br> > > > <label> > > > <input type="radio" name="taalkeuze" value="woord_des"> > > > Oostends-desnerck</label> > > > </font></strong></em></td> > > > <td width="22%" valign="middle"><p> <em><strong><font > > size="2" > > > face="Tahoma"> > > > <label> > > > <input type="radio" name="taalkeuze" value="woord_nl"> > > > Nederlands</label> > > > <br> > > > <label> > > > <input type="radio" name="taalkeuze" value="woord_fr"> > > > Frans</label> > > > </font></strong></em></p></td> > > > <td width="25%"><em><strong><font size="2" face="Tahoma"> > > > <label> > > > <input type="radio" name="taalkeuze" value="woord_eng"> > > > Engels</label> > > > <br> > > > <label> > > > <input type="radio" name="taalkeuze" value="verklaring"> > > > Verklaring</label> > > > </font></strong></em></td> > > > <td width="20%"><div align="center"><font size="2" > > > face="Tahoma">Hulp > > > bij het zoeken</font></div></td> > > > </tr> > > > <tr align="left" valign="middle" bordercolor="#000033" > > > bgcolor="#FFFFFF"> > > > <td height="33" colspan="4" align="center" valign="top" > > > bgcolor="#FFFFCC"><p><font size="2" face="Tahoma"> > > > <input name="zoekwoord" type="text" id="zoekwoord2" > > > value="" > > > size="50" maxlength="40"> > > > <input type="submit" name="Submit" value="Zoekn"> > > > </font><font size="2" face="Tahoma"> </font></p> > > > <blockquote> > > > </blockquote></td> > > > </tr> > > > </table> > > > </form> > > > > > > </tr> > > > </table>'; > > > > > > > > > if ($taalkeuze === NULL) > > > { > > > $taalkeuze = "woord_ost"; > > > } > > > > > > > > > $van = 0; > > > $tot = 5; > > > > > > > > > mysql_connect("**.**.**.**", "******", "********") or die > > (mysql_error()); > > > > > > $Query_beperkte_records = "SELECT woordenboek.* FROM woordenboek WHERE > > " > > > .$taalkeuze. " LIKE '%" .$zoekwoord. "%' ORDER BY > > woordenboek.woord_ost > > > ASC > > > LIMIT ".$van.",".$tot; > > > $Query_alle_records = "SELECT woordenboek.* FROM woordenboek WHERE " > > > .$taalkeuze. " LIKE '%" .$zoekwoord. "%'"; > > > $result = mysql("oostends",$Query_beperkte_records) or > > die(mysql_error()); > > > $query = mysql("oostends",$Query_alle_records) or die(mysql_error()); > > > $num3 = mysql_num_rows($query); > > > $num2 = $num3 / $tot;. > > > $num = ceil($num2);. > > > > > > > > > if ($num > 1) > > > { > > > for ($i = 1; $i <= $num; $i++) > > > > > > > > > $van2 = ($i * $tot) - $tot; > > > if ($i == $page) > > > $pages[$i] = "<font face=\"trebuchet ms\" > > > color=\"#C0C0C0\"><b>$i</b></font>";. > > > else > > > $pages[$i] = "<font face=\"trebuchet ms\"><b><a > > > href=\"$php_self?page=$i&van=$van2&tot=$tot\">$i</a></b></font>"; > > > } > > > $pages = implode("<b> | </b>", $pages); > > > $vorige = ($page-1) ? "<font face=\"trebuchet ms\"><b><a > > > href=\"$php_self?page=" . ($page - 1) . "&van=" . ($van - $tot) . > > > "&tot=$tot\">< Vorige</a></b></font>" : ""; > > > $volgende = ($page-$num) ? "<font face=\"trebuchet ms\"><b><a > > > href=\"$php_self?page=" . ($page + 1) . "&van=" . ($van + $tot) . > > > "&tot=$tot\">Volgende ></a></b></font>" : ""; > > > > > > if ($vorige && $volgende) > > > $navigation = "$vorige | $pages | $volgende"; > > > else > > > $navigation = "$vorige | $pages | $volgende"; > > > } > > > print $navigation; > > > > > > > > > while ($gegevens=mysql_fetch_object($result)) > > > { > > > echo > > > "<table width=\"100%\" border=\"0\"cellpadding=\"2\" > > summary=\"oostends > > > interactief woordenboek\"> > > > <tr> > > > <td width=\"18%\" colspan=\"1\" rowspan=\"2\"valign=\"top\"><div > > > align=\"left\"><font color=\"#000080\" ><strong><font size=\"3\" > > > face=\"Tahoma\">". > > > $gegevens->woord_ost. "</strong></div></p>"; > > > if ($gegevens->geluid != NULL) > > > { > > > echo "<a href=\"". $gegevens->geluid. "\"><img > > > src=\"plaatjes/button_luister.gif\" width=\"21\" height=\"24\" > > > border=\"0\"></a>";} > > > else > > > { > > > echo ""; > > > } > > > > > > echo " > > > <a href=\"". $gegevens->geluid. "\"><img > > > src=\"plaatjes/button_statistiek.gif\" width=\"21\" height=\"24\" > > > border=\"0\"></a> > > > <a href=\"". $gegevens->geluid. "\"><img > > > src=\"plaatjes/button_stemmen.gif\" width=\"21\" height=\"24\" > > > border=\"0\"></a><div align=\"left\"> > > > </td> > > > <td width=\"6%\" rowspan=\"2\" align=\"left\" valign=\"top\"><div > > > align=\"left\"><strong><font size=\"1\" > > > face=\"Tahoma\">Volgnr</font></strong></div></td> > > > <td width=\"76%\" align=\"left\" valign=\"top\"><font > > > color=\"#009966\"><strong><em><font face=\"Tahoma\">" > > > .$gegevens->woord_des. "<font size=\"1\" ></strong> (ost_desn) , > > > </em><font size=\"2\"><strong><em>" > > > .$gegevens->woord_nl. "<font size=\"1\" ></strong> (nl) , <font > > > size=\"2\"><strong><em>" > > > .$gegevens->woord_fr. "<font size=\"1\" ></strong> (fr) , <font > > > size=\"2\"><strong><em>" > > > .$gegev > > > ens->woord_eng. "<font size=\"1\" ></strong> (eng) , > > > </em></strong><font > > > size=\"2\"><font color=\"#000000\">" > > > .$gegevens->verklaring."</div></td> > > > </tr> > > > <tr>"; > > > if ($gegevens->multimedia != NULL) > > > { > > > echo "<td width=\"80%\" height=\"20%\" align=\"left\"><img src=\"" > > > .$gegevens->multimedia. "\" width=\"170\" height=\"124\" > > > border=\"1\"></td>"; > > > } > > > else > > > { > > > echo ""; > > > } > > > echo " </tr> </table>"; > > > echo "<hr>"; > > > } > > > print $navigation; > > > > > > ?> > > > > > > > > > </body> > > > </html> > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php