viperxx Posted August 16, 2005 Posted August 16, 2005 After upgrading to MySQL Server 4.1.13 I started receiving the error below in admin/orders.php (selecting a customer with no orders and clicking the orders button in the admin): 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 o.orders_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from orders o left join orders_total ot on (o.orders_id = ot.orders_id), orders_status s where o.customers_id = '932' and o.orders_status = s.orders_status_id and s.language_id = '1' and ot.class = 'ot_total' order by orders_id DESC limit -20, 20 From what I can tell, the problem is because of the "limit". The limit is between "-20" and "20" (not sure why, and I am not going to research far enough to find out why right now). I assume this has always been like this and the new version of MySQL does not allow for starting a limit with a negative number. As a temporary solution, I went into admin/includes/classes/split_page_results.php and around line 38 I added: if ($offset < 0) { $offset = 0; } The original looked like this: $offset = ($max_rows_per_page * ($current_page_number - 1)) $sql_query .= " limit " . $offset . ", " . $max_rows_per_page; It should look like this (temp fix only, I may look into it further later to figure out why it uses a negative number to begin with, I'm sure its just the math the function uses to find the first record for paging). $offset = ($max_rows_per_page * ($current_page_number - 1)) if ($offset < 0) { $offset = 0; } $sql_query .= " limit " . $offset . ", " . $max_rows_per_page; If anyone else wants to look into it if they have a problem and come up with a more permanent fix, feel free. I haven't searched the forums too much for this problem. When I did, I wasn't able to find anything, so I am posting the fix I used.
AlanR Posted August 16, 2005 Posted August 16, 2005 See: http://www.oscommerce.com/community/bugs,1605 Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)
viperxx Posted August 16, 2005 Author Posted August 16, 2005 See: http://www.oscommerce.com/community/bugs,1605 <{POST_SNAPBACK}> Wow, someone else already fixed it. Just curious, what did you search for to find it? I looked a bit but couldn't find anything on it. Thanks!
AlanR Posted August 16, 2005 Posted August 16, 2005 Wow, someone else already fixed it. Just curious, what did you search for to find it? I looked a bit but couldn't find anything on it. Thanks! <{POST_SNAPBACK}> I keep a little database of useful links. The problem has been posted several times. Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.