OpenKB::Server Technical Papers

oscommerce

1064 – SQL query error oscommerce

by admin on Mar.30, 2008, under oscommerce

1064 – 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 ‘-20, 20′ at line 1

To fix this

In admin/includes/classes find split_page_results.php and – BACK IT UP then find the lines

$offset = ($max_rows_per_page * ($current_page_number – 1));
$sql_query .= ” limit ” . $offset . “, ” . $max_rows_per_page;

change to

$offset = ($max_rows_per_page * ($current_page_number – 1));
if ($offset < 0)
{
$offset = 0 ;
}
$sql_query .= ” limit ” . $offset . “, ” . $max_rows_per_page;

MySQL 4.1.xx handles negatives correctly (by forcing an error) in the code above unlike earlier versions of MySQL.

=========

Thanks to   Charles Kangethe on http://forums.oscommerce.com/index.php?showtopic=144095&hl=1064

Comments Off more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!