Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

1064 Errors


Daddyslipdisk

Recommended Posts

Posted

Apparently something went wrong during an installation, but I've done so much configuring that it's tough to start over. I had a OSC template and it was obviously missing some pieces or something is just plain wrong. For normal reasons, in the admin section, I cleared out the manufacturers that were pre-installed and also the reviews. But the second I removed that last review, I get:

 

************************************

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

 

select reviews_id, products_id, date_added, last_modified, reviews_rating from reviews order by date_added DESC limit -6, 6

**************************************

 

The same thing happened when I removed the last manufacturer from the list, the Specials area and the Products Expected area. All of those sections give the same error above. Everything on the front end appears to be working fine EXCEPT for when you click on Specials which has 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 '-9, 9' at line 1

 

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -9, 9

**************************************

 

So apparently, I think these are all connected somehow since the error number stays the same in all of the problems. Any thoughts how to fix this problem?

Posted

You have a very old version of osC you're trying to use. Newer versions have some protection against this error in admin/includes/classes/split_page_results.php:

      $sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;

and includes/classes/split_page_results.php

      $this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;

This makes sure the first value after "limit" (the starting row number) is at least 0.

 

These are the only two places in "vanilla" osC. Custom code in your template may have more places where the same thing has to be done (replace $offset or similar with max($offset, 0)).

Posted

You have a very old version of osC you're trying to use. Newer versions have some protection against this error in admin/includes/classes/split_page_results.php:

      $sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;

and includes/classes/split_page_results.php

      $this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;

This makes sure the first value after "limit" (the starting row number) is at least 0.

 

These are the only two places in "vanilla" osC. Custom code in your template may have more places where the same thing has to be done (replace $offset or similar with max($offset, 0)).

 

Thank you sir! That fixed it.

Archived

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

×
×
  • Create New...