Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error 1064


doteasy

Recommended Posts

Posted

I am getting this error on the specials.php page. I have seen simlar but they are near '-20, 20' where I am on '-6, 6'

 

I'm on a server with PHP 5.0.4

 

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 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 -6, 6

 

[TEP STOP]

 

Any help on this would be great.

 

Thank you in advance.

Posted
It's the same cause. You can install the latest oscommerce update (or just the part to do with split page results) and you should be OK.

 

Jack

 

 

The split page result is done in the admin/includes/classes or just includes/classes?

 

Sorry I am not a very techincal person.

Posted

it's done with both, and by all means do all updates from the update file. No sense to work on a version that has been updated many times already ...

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted
it's done with both, and by all means do all updates from the update file. No sense to work on a version that has been updated many times already ...

 

I am already using osCommerce 2.2 Milestone 2 Update 060817

 

So what do I need to look for and change to fix this error?

Posted
it's done with both, and by all means do all updates from the update file. No sense to work on a version that has been updated many times already ...

 

I made the change in the admin/includes/classes/split_page_results.php but the error is still there with no change.

 

From this :

 

$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;

 

I am not sure what to change in the includes/classes/split_page_results.php

 

Am I doing something wrong still?

Posted

my update file has this info:

 

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

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;

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted
my update file has this info:

 

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

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;

 

That works!!

 

Thank you very much!

Posted
I am already using osCommerce 2.2 Milestone 2 Update 060817

 

So what do I need to look for and change to fix this error?

glad to hear it works, but your statement above worries me as that version has this patch already applied. Test try a few other files (I'd do the shopping_cart.php class) ... it may be that you are not on the version you think you are.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Archived

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

×
×
  • Create New...