Hi,
i just repost this topic after finding out there's no reply for it, thus i'm having the same problem.
Anybody that can help and/or give their opinion would be much appreciated.
foodstyling, i'm reposting your topic.
thanks.
---------------------------------------------------------------
I have a problem to get a pagination system to work:
I have 1 form with I select query named catID and a text search named ingredienten.
The answers for the queries are ok. The results for the first page are correct, but when I go to the second page I get no results at all. Anybody with a solution?
$catID = $_POST['catID'];
if (count($catID) > 0) {
// loop through the array
for ($i=0;$i<count($catID);$i++) {
}
}
$result= "SELECT catID, catName FROM categories WHERE catID = ('$catID') ORDER BY catID";
$result= mysql_query($result);
while ($row = mysql_fetch_array($result)) {
$catID = $row['catID'];
}
$param1=($_POST['ingredienten']);
$recept = $_POST['ingredienten'];
if (count($recept) > 0) {
// loop through the array
for ($i=0;$i<count($recept);$i++) {
}
}
if (!empty($_POST['ingredienten'])){
//use single quote when searching for text elements
//use "%" before AND after to allow search for elements that occur in
//the middle of the string
$result ="SELECT recept AS RECEPTEN FROM recepten WHERE ingredienten LIKE
'%$param1%' AND catID = ('$catID') ORDER BY recept LIMIT $from, $max_results";
$result = mysql_query($result);
while ($row = mysql_fetch_array($result)) {
$recept=$row['recept'];
// show table
echo "<p>\n";
show_table($result);
echo "</p>\n";
}
}
else{
echo "<h3><font color=#O42C89>U HEEFT GEEN INGREDIENT INGEVOERD</font></h3>";
}
if(mysql_num_rows($result) == 0)
{
echo"<h3><font color=#O42C89>SORRY, ER ZIJN GEEN RESULTATEN GEVONDEN.<br
PROBEER HET OPNIEUW IN EEN ANDERE CATEGORIE OF MET EEN ANDER INGREDIENT.</font></h3>";
}
$total_results = mysql_query("SELECT COUNT(recept) AS Num FROM recepten WHERE ingredienten LIKE
'%$param1%' AND catID = ('$catID')");
while($row = mysql_fetch_array($total_results));
$recept=$row['recept'];
echo "<p>Er zijn in het totaal<font color = #042C89> ",mysql_result($total_results,0, 0),"</font>
recepten welke beantwoorden aan uw zoekopdracht </p\n";
// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);