Ohh you are right but I just put the mysql_error(); to test. In the end, It is the same for me if I echo a "ERROR" instead. But I don't use it once it is working properly.
I am having terrible problems with this search function. When I go to the site and press the link 'Buscador' it goes to 'index.php?p=buscar' and then imagine I get 21 results and I only want to display 15 per peage. I have a pagecalc script I made but when I click on page 2 it goes to 'index.php?p=buscar&n=15' where n= number of page. For example n=0 -> page 1, n=15 -> page 2, etc.
I still can't figure it out how to make it work. ;[ when I click page 2 it shows me a blank page, or shows nothing.
This is my pagecalc script I made for search function:
Code: Select all
public function CalcPagesSearch($total)
{
$eachpage= 15;
$numofpages= ceil($total/$eachpage);
if ($_GET['n'] == "0" || $_GET['n'] < "15")
$echo.= "«";
else
{
$previous= $_GET['n']-$eachpage;
$echo.= "<a href='./?p=buscar&n=$previous'>«</a>";
}
for ($x=1; $x <= $numofpages; $x++)
{
$start= ($x*$eachpage)-$eachpage;
if ($_GET['n'] == $start)
$echo.= " $x";
else $echo.=" <a href='./index.php?p=buscar&n=$start'>$x</a>";
}
$last= ($numofpages*$eachpage)-$eachpage;
if ($_GET['n'] == $last || $last < "0")
$echo.= " »";
else
{
$next= $_GET['n']+$eachpage;
$echo.= "<a href='./index.php?p=buscar&n=$next'> »</a>";
}
echo "<center>".$echo."</center>";
}
I hope you guys can help me with this. I've been trying to make it work all day long. :<