Re: navigatie doesn't work in this script
| From: | danny | Date: | Sun, 29 Sep 2002 19:55:49 +0000 |
| Subject: | Re: navigatie doesn't work in this script | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118122@lists.php.net to get a copy of this message | ||
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 <holmes072000@charter.net> schreef in berichtnieuws
001401c267ee$e6a510d0$7c02a8c0@coconut...
> 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:phpdummy@belgacom.net]
> > Sent: Sunday, September 29, 2002 3:21 PM
> > To: php-general@lists.php.net
> > 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
>
>
>