Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

sql error when no rows returned


Juniyakers

Recommended Posts

I recently changed server. Since the swap I get this error if an SQL query doesnt return anything (eg customer has no orders):

 

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 = '126' 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

 

If anyone knows how I can fix this, I would really appreciate it!

 

Lowri

Link to comment
Share on other sites

I would guess your new server uses a newer version of mySQL

 

The fix is here:

 

http://www.oscommerce.com/forums/index.php?sho...26entry697026

 

I recently changed server. Since the swap I get this error if an SQL query doesnt return anything (eg customer has no orders):

 

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 = '126' 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

 

If anyone knows how I can fix this, I would really appreciate it!

 

Lowri

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...