i want to implement a paging thing in a search function i have, but i can't get it right.
i've looked for this question in the forum but i can't find nothing for my needs, i've tried posting yhis question before but didn't get to solve the problem.
now i have evolved a little more, but i still can't get the whole thing done.
this is the function being called:
function detailsSearch($search) {
$start = 0;
$pagelimit = 10;
$sql = "SELECT * FROM products WHERE model LIKE '%$search%' OR type LIKE '%$search%' OR brand LIKE '%$search%' LIMIT $start,$pagelimit";
$rs=$this->bd->executeSQL($sql);
$pagelimit2 = $pagelimit + 10;
$start2 = $pagelimit;
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"caixas\"><tr>
<td class=\"titulo\">See</td>
<td class=\"titulo\">Type</td>
<td class=\"titulo\">Brand</td>
<td class=\"titulo\">Model</td>
<td class=\"titulo\">Price</td>
<td class=\"titulo\">Avail.</td></tr>";
echo "<tr bgcolor=\"#FFFFFF\">";
$n=0;
$count=0;
while(mysql_fetch_row($rs)) {
$bgcolor = ($count++ % 2) ? "#FFFFFF" : "#E9E9EC";
echo "<td bgcolor=\"$bgcolor\"><a href=\"index.php?page=product&type=".mysql_result($rs, $n, "type")."
&model=".mysql_result($rs, $n, "model")."&cod=".mysql_result($rs, $n, "cod")."
&price=".mysql_result($rs, $n, "price")."\">
<img src=\"imagens/seta.gif\" border=\"0\" width=\"12\" height=\"10\"></td>
<td bgcolor=\"$bgcolor\">".mysql_result($rs, $n, "type")."</td>
<td bgcolor=\"$bgcolor\"><a href=\"index.php?page=brand
&brand=".mysql_result($rs, $n, "brand")."\">".mysql_result($rs, $n, "brand")."</td>
<td bgcolor=\"$bgcolor\">".mysql_result($rs, $n, "model")."</td>
<td bgcolor=\"$bgcolor\" align=\"center\">".mysql_result($rs, $n, "price")." €</td>
<td bgcolor=\"$bgcolor\">".mysql_result($rs, $n, "avail")."<br></td>";
echo "</tr>";
$n++;
}
echo "</table>";
echo "<a href=$PHP_SELF?page=search&start=$start2&pagelimit=$pagelimit2>Next</a>";
}
this returns ten results, but when i click the next button i get 10 results again but 6 are the same and 4 are new, and i can't get 10 more.
can anyone spare the time to help me get this done, please?
i know that i haven't got much for now🙁
thanks in advance!