<? php how can let rows throught to next page?

Just_DO_it

New member
this is my query (paging code working fine with normal query but with this one because it has array ) am getting error


$where = array();

$agemin=$_POST['agemin'];
$agemax=$_POST['agemax'];

$countrystayings = array('uk','usa','italy','France');

if (in_array($countrystaying,$countrystayings))
{
$where[] = "countrystaying= '{$countrystaying}'";
}

$Q=implode(' AND ',$where);
$sql = "SELECT * FROM users WHERE '$Q' LIMIT $offset,$results_per_page";

when I run this query I got the frist 5 records which limit is 0,5
when i press to next page it gives me this error

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND LIMIT 5,5' at line 1.
 
Back
Top