Guest Posted November 23, 2009 Share Posted November 23, 2009 I am receiving the following mysql error while trying to access my specials module in the admin: Specials 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, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from products p, specials s, products_description pd where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = s.products_id order by pd.products_name limit -20, 20 [TEP STOP] Can anyone help me on this? Thanks Link to comment Share on other sites More sharing options...
MrPhil Posted November 23, 2009 Share Posted November 23, 2009 What version of osC are you running? Newer versions have this patched. Instead of just $offset in an SQL "limit" phrase, they use max($offset, 0). In includes/classes/split_page_results.php, change $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; Do the same in admin/includes/classes/split_page_results.php: $sql_query .= " limit " . $offset . ", " . $max_rows_per_page; to $sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page; If your code was already updated so, the problem must lie elsewhere, such as in an add-on. Look for limit in the PHP code, and check that the first value following is either a constant or is constrained with max($offset, 0) style coding. The actual variable used may of course be something other than $offset. Link to comment Share on other sites More sharing options...
Guest Posted November 23, 2009 Share Posted November 23, 2009 Thanks a bunch Phil, got it working. :thumbsup: Link to comment Share on other sites More sharing options...
silkua Posted December 25, 2009 Share Posted December 25, 2009 MrPhil - :thumbsup: HCh & HNY Andrey. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.