Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

1064 - You have an error in your SQL syntax near '


Guest

Recommended Posts

>_< For some reason when I log into my admin area and attempt to check customer's orders I get this error.

 

1064 - You have an error in your SQL syntax near 'limit 0, 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 = '8' and o.orders_status = s.orders_status_id and s.language_id = '1' and ot.class = 'ot_total' order by limit 0, 20

 

[TEP STOP]

 

 

Will someone please tell me how I might fix this? Immediatly following that error I get a box that goes from left to right across the legnth of the page with a lot of broken images. It's killing me that I can't get this to work when it was working just fine yesterday. GRRRRR :'(

 

Thank you in advance

Link to comment
Share on other sites

I get this error too.. Fresh install no contribs...LAtest version

 

I think it has to do with the version of mysql althought the setup went fine...

 

 

I dropped all tables from BD and added sql from install file.

 

Error still remains. However it will show when there is Zero

 

Example after fresh install go to customers and it lists john doe... no error.. after you delete john doe then there is error..

 

 

Customers Search:

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 c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, a.entry_country_id from customers c left join address_book a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id order by c.customers_lastname, c.customers_firstname limit -20, 20

 

My sql version is...

 

mysql Ver 14.7 Distrib 4.1.7, for pc-linux (i686)

 

Thanks!

Link to comment
Share on other sites

Actually I just reinstalled it and that fixed it. But no I hadn't added any mods like that at all. Still having other issues with OSC that I posted about but as of yet have heard nothing back on. But thank you for your response.

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 months later...
I only know the reason for this problem. MySQL  with version higher than 4.X doesn?accept null or negative values. But I am not familiar with SQL therfore I can?t solve the problem

 

 

Have anyone solve this problem? I get this error on all pages with empty tables.

Link to comment
Share on other sites

related to mysql 4.1, search tips and tricks for 1064

 

Thanks a lot!

 

Anyone else need this?

Here is the fix I found, and it works!! :-)

 

--------------------------------------------------

 

In admin/includes/classes find split_page_results.php and - BACK IT UP then find the lines

 

$offset = ($max_rows_per_page * ($current_page_number - 1));

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

change to

 

$offset = ($max_rows_per_page * ($current_page_number - 1));

if ($offset < 0)

{

$offset = 0 ;

}

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

------------------------------------------------

Link to comment
Share on other sites

  • 4 months later...
Thanks a lot!

 

Anyone else need this?

Here is the fix I found, and it works!! :-)

 

--------------------------------------------------

 

In admin/includes/classes find split_page_results.php and - BACK IT UP then find the lines

 

$offset = ($max_rows_per_page * ($current_page_number - 1));

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

change to

 

$offset = ($max_rows_per_page * ($current_page_number - 1));

if ($offset < 0)

{

$offset = 0 ;

}

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

 

------------------------------------------------

 

 

Thanks for the contribution! It Worked.....

 

Ed

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...