1064 - You have an error in your SQL syntax
#41
Posted 11 August 2005, 17:04
See bug report
http://www.oscommerce.com/community/bugs,1605
HTH
Tom
#42
Posted 12 August 2005, 10:07
Thanks for the reply.
I applied the fix to admin/includes/class/split_page_results.php, however I tried changing the includes/classes/split_page_results.php but the file is different to the admin one and the lines:
$offset = ($max_rows_per_page * ($current_page_number - 1));
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
Do not exsist in that file; changing the admin file did allow me to view the orders page (resolved the 1064 error). However now when I try and delete Manufacturers the following error is displayed:
Warning: Cannot modify header information - headers already sent by (output started at /home/sansal00/public_html/admin/includes/classes/split_page_results.php:109) in /home/sansal00/public_html/admin/includes/functions/general.php on line 18
Any idea's what is causing this problem?
Thanks
Edited by toby_uk, 12 August 2005, 10:07.
#43
Posted 12 August 2005, 10:15
Simplyeasier, on Apr 1 2005, 09:10 AM, said:
First off - this fix is actually already recorded in the contributions section and many thanks to those who recorded it - but I don't think it is a contribution - rather a tip - Secondly the same problem has arisen for 4 people in a few days and I dare say it will happen to more as hosts migrate their mySQL databases to version 4.1.xx -
Hence I post here
If you get an error whilst creating \ modifying your database such that thro admin you delete all entries on a particular table you will likely get this 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 '-20, 20' at line 1
followed by something like
select manufacturers_id, manufacturers_name, manufacturers_image, date_added, last_modified from manufacturers order by manufacturers_name limit -20, 20
or
select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added from banners order by banners_title, banners_group limit -20, 20
depending on which table you have deleted all records from.
To fix this
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;
MySQL 4.1.xx handles negatives correctly (by forcing an error) in the code above unlike earlier versions of MySQL.
hth
Charles
Thanks for that, my site is now back working
caroline
#44
Posted 12 August 2005, 13:30
toby_uk, on Aug 12 2005, 10:07 AM, said:
Thanks for the reply.
I applied the fix to admin/includes/class/split_page_results.php, however I tried changing the includes/classes/split_page_results.php but the file is different to the admin one and the lines:
$offset = ($max_rows_per_page * ($current_page_number - 1));
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
Do not exsist in that file; changing the admin file did allow me to view the orders page (resolved the 1064 error). However now when I try and delete Manufacturers the following error is displayed:
Warning: Cannot modify header information - headers already sent by (output started at /home/sansal00/public_html/admin/includes/classes/split_page_results.php:109) in /home/sansal00/public_html/admin/includes/functions/general.php on line 18
Any idea's what is causing this problem?
Thanks
#45
Posted 25 August 2005, 08:43
I'm back again, I thought this problem had been fixed, but unfortunately not. I applied the fix to admin/includes/class/split_page_results.php, however I tried changing the includes/classes/split_page_results.php but the file is different to the admin one so didn't know which bit to change. The change meant I am able to update from the admin side with no problems, now however the 'specials' page results in 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
[TEP STOP]
See the problem Here
Can anybody help, I have no idea what to do now
Thanks
#46
Posted 25 August 2005, 17:39
toby_uk, on Aug 25 2005, 10:43 AM, said:
This should work:
$offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1));
// begin make sure that $offset is not lower than 0
if ($offset < 0 ) {
$offset = 0;
}
// end make sure that $offset is not lower than 0
$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;
#47
Posted 25 August 2005, 23:01
#48
Posted 26 August 2005, 03:31
"Orders Order ID:
Status: All OrdersPendingProcessingDelivered
Customers Order Total Date Purchased Status Action
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 '-30, 30' at line 1
select o.orders_id, o.customers_name, 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.orders_status = s.orders_status_id and s.language_id = '1' and ot.class = 'ot_total' order by o.orders_id DESC limit -30, 30
[TEP STOP]"
CODE:
admin/includes/classes/split_page_results.php:
$offset = ($max_rows_per_page * ($current_page_number - 1));
// begin make sure that $offset is not lower than 0
if ($offset < 0 ) {
$offset = 0;
}
// end make sure that $offset is not lower than 0
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
}
catalog/includes/classes/split_page_results.php:
$offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1));
// begin make sure that $offset is not lower than 0
if ($offset < 0 ) {
$offset = 0;
}
// end make sure that $offset is not lower than 0
$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;
Any suggestions?
Thank you,
Rebecca
#49
Posted 26 August 2005, 04:04
Rebecca
#50
Posted 28 August 2005, 04:43
Lauren
#51
Posted 28 August 2005, 19:27
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 '-10, 10' at line 1 select distinct p.products_id, p.products_image, p.products_model, p.products_quantity, p.products_weight, pd.products_name, p.manufacturers_id, p.products_price, p.products_date_added, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, m.manufacturers_name, pd.products_description, cd.categories_name from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join categories_description cd on p2c.categories_id = cd.categories_id left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and cd.language_id = '1' order by cd.categories_name DESC, pd.products_name LIMIT -10, 10
i getting this error on my catalog side when Page Cache is enabled , if i loged in (Page Cache disabled) , so everything fine
i tried all suggestions from this thread and more , but still having trouble.
Please , if somebody have any idea what is causing this problem ...
Thank You !
#52
Posted 02 September 2005, 05:16
I applied the bug fix from http://www.oscommerce.com/community/bugs,1605
on both my admin/includes/classes/split_page_results.php
the admin works great
and /includes/classes/split_page_results.php
this is from the catalog side
Quote
if ($offset < 0)
{
$offset = 0 ;
}
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
and /includes/classes/split_page_results.php
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 'where lc.link_categories_id = lcd.link_categories_id and lc.link_categories_stat' at line 1 select lc.link_categories_id, lcd.link_categories_name, lcd.link_categories_description,peacem_link_categories lc, peacem_link_categories_description lcd where lc.link_categories_id = lcd.link_categories_id and lc.link_categories_status = '1' and lcd.language_id = '1' order by lcd.link_categories_name [TEP STOP]
I even added a link to the database and still get this error.
please help if you can.
I added this to a different program and didn't have thiis problem
"War is --the old betraying the young"
#53
Posted 04 September 2005, 22:01
http://forums.oscommerce.com/index.php?showtopic=168606&st=
Anyone to help me ?
#54
Posted 10 September 2005, 17:16
MY VERSION IS 4.0.22-standard
Clientes Buscar:
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 'where c.customers_lastname like '%lero%' or c.customers_firstna
select count(*) as total from customers c, address_book a, customers_info ci where c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id and c.customers_id = ci.customers_info_id where c.customers_lastname like '%lero%' or c.customers_firstname like '%lero%' or c.customers_email_address like '%lero%'
THANKS FOR YOUR HELP
#55
Posted 10 September 2005, 22:07
rootuser, on Jun 21 2005, 05:41 AM, said:
The fix for this is:
Edit these two files:
admin/includes/classes/split_page_results.php
/includes/classes/split_page_results.php
Insert:
if ($offset < 0)
{
$offset = 0 ;
}
Just before this line:
$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;
Thanks a lot for the fix ....
#56
Posted 11 September 2005, 03:54
Here is what I am getting on catalog/account_history.php
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 '-10, 10' at line 1
select o.orders_id, o.date_purchased, o.delivery_name, o.billing_name, ot.text as order_total, s.orders_status_name from orders o, orders_total ot, orders_status s where o.customers_id = '20' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '1' order by orders_id DESC limit -10, 10
I did just change my orders.php but I had to in order to get the Cash/Check orders to show up in my admin section again.
Help!
Here is my /includes/classes/split_page code
$offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1));
// begin make sure that $offset is not lower than 0
if ($offset < 0 ) {
$offset = 0;
}
// end make sure that $offset is not lower than 0
$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;
#57
Posted 11 September 2005, 14:21
#58
Posted 12 September 2005, 00:35
I'll be working on it too, but any help would be appreciated, thanks!
#59
Posted 24 September 2005, 00:55
did a 'google' and found the post:
http://forums.oscommerce.com/index.php?showtopic=144095&st=0
sorted it.
#60
Posted 26 September 2005, 23:29
Can anyone suggest where I need to look to fix this? Is there something I need to alter within the database itself?
Cheers,
Richard
Richard














