Oscommerce – 1064 – You have an error in your SQL syntax;

Client of mine had an error in an old version of Oscommerce with the featured product.

Error:
Featured Products
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

select p.products_id, pd.products_name, s.featured_id, s.featured_date_added, s.featured_last_modified, s.expires_date, s.date_status_change, s.status from products p, featured s, products_description pd where p.products_id = pd.products_id and pd.language_id = ‘4’ and p.products_id = s.products_id order by pd.products_name limit -20, 20

[TEP STOP]

Solution:

CODE
Line 67 in catalog/includes/classes/split_page_results.php must be changed from:

$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;

to

$this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;

Line 38 in catalog/admin/includes/classes/split_page_results.php must be changed from:

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

to

$sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;

Geplaatst

in

,

door

Tags:

Reacties

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *