quag2000 Posted June 1, 2005 Share Posted June 1, 2005 Hi, I appear to have a broken admin->customers->orders page. When clicked it comes up with the following error. 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 'limit 0, 20' at line 1 select o.orders_id, o.customers_name, 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.orders_status = s.orders_status_id and s.language_id = '1' and ot.class = 'ot_total' order by limit 0, 20 [TEP STOP] I have tried some of the previously posted fixes applying to very similar problems, but with no success. Anyone? :'( Link to comment Share on other sites More sharing options...
quag2000 Posted June 1, 2005 Author Share Posted June 1, 2005 Can anyone help here? I have found many similar posts, but noe that help me so far. My knowledge on sql is pretty much nothing. Cheers! :( Link to comment Share on other sites More sharing options...
FalseDawn Posted June 2, 2005 Share Posted June 2, 2005 The problem is here: order by limit 0, 20 You need to be ordering by a column name, which is missing. What contribution(s) have you installed? Link to comment Share on other sites More sharing options...
quag2000 Posted June 2, 2005 Author Share Posted June 2, 2005 The problem is here:order by limit 0, 20 You need to be ordering by a column name, which is missing. What contribution(s) have you installed? <{POST_SNAPBACK}> Thanks for your reply! Most recently I installed Downloads Controller which modified the database I think. I also use the Easy Populate contribution. I am not sure when this issue arose as I did not attempt to use the admin>customers>orders function until now. I see what you are saying, it should have a colum name before limit? Cheers Link to comment Share on other sites More sharing options...
quag2000 Posted June 2, 2005 Author Share Posted June 2, 2005 This appears to be the problem area. How do i edit my database.. or find out what I should change this to? if (isset($HTTP_GET_VARS['cID'])) { $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']); $orders_query_raw = "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 " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by $order"; } elseif (isset($HTTP_GET_VARS['status'])) { $status = tep_db_prepare_input($HTTP_GET_VARS['status']); $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by $order"; } else { $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by $order"; Link to comment Share on other sites More sharing options...
FalseDawn Posted June 2, 2005 Share Posted June 2, 2005 Try replacing with this stock code. I think the $orders variable it is trying to order by has not been defined. if (isset($HTTP_GET_VARS['cID'])) { $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']); $orders_query_raw = "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 " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by orders_id DESC"; } elseif (isset($HTTP_GET_VARS['status'])) { $status = tep_db_prepare_input($HTTP_GET_VARS['status']); $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id DESC"; } else { $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by o.orders_id DESC"; } Link to comment Share on other sites More sharing options...
quag2000 Posted June 2, 2005 Author Share Posted June 2, 2005 OHHHH!!!! THANKYOU!!! Thanks so much! That did the trick perfectly. And by my limited knowledge, that appears to only be the listing order of the results, so there is no functionality I would be missing by the modified code not working. Again! Thanks so much! I'll see what else I can break now! Do you have much experience with overlapping customer sessions? I had a topic yesterday dealing with my problems, but I am ansure if I have really solved it, or just stopped receiving complaints. Cheers here is the original post if you get a chance to take a peek. http://www.oscommerce.com/forums/index.php?showtopic=153560 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.