Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

1064 - You have an error in your SQL syntax


rpwilkins

Recommended Posts

Can anyone help me please?

 

I am setting up an online store using oscommerce and in the admin section on the products attributes section I get the following error message:

 

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 '-0, MAX_ROW_LISTS_OPTIONS' at line 1

 

select * from products_options where language_id = '1' order by products_options_id limit -0, MAX_ROW_LISTS_OPTIONS

 

My host server is installed with PHP Version 4.4.9 and mysql 5.0.67 and I can only assume it's an error in the coding/mysql version

 

Does anyone know what I need to change to fix this?

 

Thanks

 

Rob

Link to comment
Share on other sites

Looks like it could be a split page results error. Try this

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;

Link to comment
Share on other sites

Thanks but I checked the code and was already as you said it should be, even tried changing it back but that didn't seem to help

 

There is an additional warning message I omitted not sure if that changes anything?

 

Warning: Division by zero in /catalog/admin/includes/classes/split_page_results.php on line 33

 

Warning: Division by zero in /catalog/admin/includes/classes/split_page_results.php on line 47

 

Both lines of code are as follows:

 

$num_pages = ceil($query_num_rows / $max_rows_per_page);

 

$num_pages = ceil($query_numrows / $max_rows_per_page);

 

Thanks again

Link to comment
Share on other sites

and did you transfer the data to your site?

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

MAX_ROW_LISTS_OPTIONS

 

Tends to indicate the configuration table does not contain the entry for MAX_ROW_LISTS_OPTIONS or it has not been read into memory.

 

G

 

PS Memo to self look at the reported problem not the answers given. Led myself astray there.

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...