RE: [PHP] navigatie doesn't work in this script
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 titleUntitled 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=TahomaOstensche encyclopedie /font /caption tr align=left valign=middle bordercolor=#33 bgcolor=#CC td width=33% height=47 align=left valign=middleemstrongfont 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=middlep emstrongfont 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%emstrongfont 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=centerfont size=2 face=TahomaHulp bij het zoeken/font/div/td /tr tr align=left valign=middle bordercolor=#33 bgcolor=#FF td height=33 colspan=4 align=center valign=top bgcolor=#CCpfont size=2 face=Tahoma input name=zoekwoord type=text id=zoekwoord2 value= size=50 maxlength=40 input type=submit name=Submit value=Zoekn /fontfont 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\ba href=\$php_self?page=$ivan=$van2tot=$tot\$i/a/b/font; } $pages = implode(b | /b, $pages); $vorige = ($page-1) ? font face=\trebuchet ms\ba href=\$php_self?page= . ($page - 1) . van= . ($van - $tot) . tot=$tot\lt; Vorige/a/b/font : ; $volgende = ($page-$num) ? font face=\trebuchet ms\ba href=\$php_self?page= . ($page + 1) . van= . ($van + $tot) . tot=$tot\Volgende gt;/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=\#80\ strongfont 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\
Re: [PHP] navigatie doesn't work in this script
In production this database will be verry big (about 1 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 titleUntitled 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=TahomaOstensche encyclopedie /font /caption tr align=left valign=middle bordercolor=#33 bgcolor=#CC td width=33% height=47 align=left valign=middleemstrongfont 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=middlep emstrongfont 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%emstrongfont 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=centerfont size=2 face=TahomaHulp bij het zoeken/font/div/td /tr tr align=left valign=middle bordercolor=#33 bgcolor=#FF td height=33 colspan=4 align=center valign=top bgcolor=#CCpfont size=2 face=Tahoma input name=zoekwoord type=text id=zoekwoord2 value= size=50 maxlength=40 input type=submit name=Submit value=Zoekn /fontfont 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\ba href=\$php_self?page=$ivan=$van2tot=$tot\$i/a/b/font; } $pages = implode(b | /b, $pages); $vorige = ($page-1) ? font face=\trebuchet ms\ba href=\$php_self?page= . ($page - 1) . van= . ($van - $tot) . tot=$tot\lt; Vorige/a/b/font : ; $volgende = ($page-$num) ? font face=\trebuchet ms\ba href=\$php_self?page= . ($page + 1) . van= . ($van + $tot) . tot=$tot\Volgende gt;/a/b/font : ; if ($vorige
RE: [PHP] navigatie doesn't work in this script
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 1 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 titleUntitled 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=TahomaOstensche encyclopedie /font /caption tr align=left valign=middle bordercolor=#33 bgcolor=#CC td width=33% height=47 align=left valign=middleemstrongfont 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=middlep emstrongfont 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%emstrongfont 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=centerfont size=2 face=TahomaHulp bij het zoeken/font/div/td /tr tr align=left valign=middle bordercolor=#33 bgcolor=#FF td height=33 colspan=4 align=center valign=top bgcolor=#CCpfont size=2 face=Tahoma input name=zoekwoord type=text id=zoekwoord2 value= size=50 maxlength=40 input type=submit name=Submit value=Zoekn /fontfont 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
Re: [PHP] navigatie doesn't work in this script
John, Ik took this script from a script-library. The problem (i think) is that the counter $tot isn't going up. It remains 5 ex: http://www.oostendseverhalen.be/test_met_navigatie3.php?page=8van=35tot=5 John W. Holmes [EMAIL PROTECTED] schreef in berichtnieuws 001a01c267f3$90b8a8d0$[EMAIL PROTECTED] 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 1 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 titleUntitled 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=TahomaOstensche encyclopedie /font /caption tr align=left valign=middle bordercolor=#33 bgcolor=#CC td width=33% height=47 align=left valign=middleemstrongfont 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=middlep emstrongfont 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%emstrongfont 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=centerfont size=2 face=TahomaHulp bij het zoeken/font/div/td /tr tr align=left valign=middle bordercolor=#33 bgcolor=#FF td height=33 colspan=4 align=center valign=top bgcolor=#CCpfont size=2 face=Tahoma input name=zoekwoord type=text id=zoekwoord2 value= size=50 maxlength=40 input type=submit name=Submit value=Zoekn /fontfont 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
Re: [PHP] navigatie doesn't work in this script
Hi, Monday, September 30, 2002, 5:20:48 AM, you wrote: d I made a MySQL database with a dictionary in it. Above there is a form in d wich you can specify some parameters. The problem is that the navigation d doesn't work well. I always get the first 5 results. Can somebody help me d out? There are about 56 records in the database. d The (not quite) working thing is on: d http://www.oostendseverhalen.be/test_met_navigatie3.php d html d head d titleUntitled Document/title d meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 d /head d body d ?php d /* hieronder volgt het formulier */ d echo ' d table width=100% border=0 align=center cellpadding=2 d tr d td height=198 form name=form1 method=post action= d table width=100% height=89 border=0 align=center d cellpadding=2 summary=interactief woordenboek Oostends nederlands, Engels en Frans. d caption d font color=#003399 size=6 face=TahomaOstensche d encyclopedie /font d /caption d tr align=left valign=middle bordercolor=#33 bgcolor=#CC d td width=33% height=47 align=left valign=middleemstrongfont size=2 face=Tahoma d label d input name=taalkeuze type=radio value=woord_ost checked d Oostends-Drooghenbroodt/label d br d label d input type=radio name=taalkeuze value=woord_des d Oostends-desnerck/label d /font/strong/em/td d td width=22% valign=middlep emstrongfont size=2 face=Tahoma d label d input type=radio name=taalkeuze value=woord_nl d Nederlands/label d br d label d input type=radio name=taalkeuze value=woord_fr d Frans/label d /font/strong/em/p/td d td width=25%emstrongfont size=2 face=Tahoma d label d input type=radio name=taalkeuze value=woord_eng d Engels/label d br d label d input type=radio name=taalkeuze value=verklaring d Verklaring/label d /font/strong/em/td d td width=20%div align=centerfont size=2 face=TahomaHulp d bij het zoeken/font/div/td d /tr d tr align=left valign=middle bordercolor=#33 bgcolor=#FF d td height=33 colspan=4 align=center valign=top bgcolor=#CCpfont size=2 face=Tahoma d input name=zoekwoord type=text id=zoekwoord2 value= d size=50 maxlength=40 d input type=submit name=Submit value=Zoekn d /fontfont size=2 face=Tahoma /font/p d blockquote d /blockquote/td d /tr d /table d /form d /tr d /table'; d if ($taalkeuze === NULL) d { d $taalkeuze = woord_ost; d } d $van = 0; d $tot = 5; d mysql_connect(**.**.**.**, **, ) or die (mysql_error()); d $Query_beperkte_records = SELECT woordenboek.* FROM woordenboek WHERE d .$taalkeuze. LIKE '% .$zoekwoord. %' ORDER BY woordenboek.woord_ost ASC d LIMIT .$van.,.$tot; d $Query_alle_records = SELECT woordenboek.* FROM woordenboek WHERE d .$taalkeuze. LIKE '% .$zoekwoord. %'; d $result = mysql(oostends,$Query_beperkte_records) or die(mysql_error()); d $query = mysql(oostends,$Query_alle_records) or die(mysql_error()); d $num3 = mysql_num_rows($query); d $num2 = $num3 / $tot;. d $num = ceil($num2);. ...snip Here is a class that will create a google like pagination of results ? class page_class { var $count = 0; //total pages var $start = 0; //starting record var $pages = 0; //number of pages available var $page = 1; //current page var $maxpages; //shows up to 2 * this number and makes a sliding scale var $show; //number of results per page function page_class($count=0,$show=5,$max=9){ $this-count = $count; $this-show = $show; $this-maxpages = $max; ($this-count % $this-show == 0)? $this-pages = intval($this-count/$this-show) :$this-pages = intval($this-count/$this-show) +1; if(!empty($_GET['search_page'])){ $this-page = $_GET['search_page']; $this-start = $this-show * $this-page - $this-show; } } function get_limit(){ $limit = ''; if($this-count $this-show) $limit = 'LIMIT '.$this-start.','.$this-show; return $limit; } function make_head_string($pre){ $r = $pre.' '; $end = $this-start + $this-show; if($end $this-count) $end = $this-count; $r .= ($this-start +1).' - '.$end.' of '.$this-count; return $r; }