waqas_punjabian Posted January 10, 2007 Share Posted January 10, 2007 Hi all, i m just new to osCommerce, well, i 've installed following contribution as per instructions: Featured Products Bynow the table 'Featured' was empty. At the end when i moved to Admin area to add some products as featured products. i 've found following Query Error in Admin's Featured Area: 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 = '1' and p.products_id = s.products_id order by pd.products_name limit -20, 20 But when i entered a record in Featured table manually using phpMyAdmin. The error removed. I think there isn't any check on null values on limit, or may be i am doing something wrong. If the error is in contribution code, then please someone rectify the error and update contribution. Or else notify me what i am doing wrong. regards WAQAS Quote Link to comment Share on other sites More sharing options...
wheeloftime Posted January 10, 2007 Share Posted January 10, 2007 Hi all, i m just new to osCommerce, well, i 've installed following contribution as per instructions: Featured Products Bynow the table 'Featured' was empty. At the end when i moved to Admin area to add some products as featured products. i 've found following Query Error in Admin's Featured Area: 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 = '1' and p.products_id = s.products_id order by pd.products_name limit -20, 20 But when i entered a record in Featured table manually using phpMyAdmin. The error removed. I think there isn't any check on null values on limit, or may be i am doing something wrong. If the error is in contribution code, then please someone rectify the error and update contribution. Or else notify me what i am doing wrong. regards WAQAS It is not an error in the contrib but something you have to change in your files if you do not use the latest MS2 release from the download section. The update document within the latest download package tells to: ------------------------------------------------------------------------------ limit -20, 20 http://www.oscommerce.com/community/bugs,1605 ------------------------------------------------------------------------------ Problem: 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 Solution: 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; Quote Link to comment Share on other sites More sharing options...
waqas_punjabian Posted January 11, 2007 Author Share Posted January 11, 2007 Howard, Thanks a lot for ur help. It 've worked out. regards WAQAS Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.