I am having 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 ''3'' at line 1

The $get1 value is 3. I tried enough but to no avail. I don't see any problem on my code.. :(

//EXCRACT THE IDs
$result = mysql_query("SELECT id FROM agents WHERE lft BETWEEN '$lft' and '$rgt' and autoshipdate BETWEEN '$unistart' and '$uniend' ORDER BY id desc LIMIT 0,'$get1'")or die(mysql_error());
$output = array();
while ($row = mysql_fetch_array($result)) {
  $output[] = "id = '".$row['id']."' ";
}
$gen1 = implode(' or ', $output);

Hi

Try using brackets..and remove the quotes near $get1

$result = mysql_query("SELECT id FROM agents WHERE (lft BETWEEN '$lft' and '$rgt') AND (autoshipdate BETWEEN '$unistart' and '$uniend') ORDER BY id desc LIMIT 0,$get1") or die(mysql_error());

That made it right. Thanks Bro! God Bless!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.