Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 2 votes

1064 - You have an error in your SQL syntax


355 replies to this topic

#261 poon

  • Community Member
  • 14 posts
  • Real Name:Ricky Poon

Posted 26 July 2008, 04:54

i get this in my specials page
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]


#262 Jan Zonjee

  • Team Member
  • 6,975 posts
  • Real Name:Jan Zonjee
  • Gender:Male
  • Location:the Netherlands

Posted 26 July 2008, 07:55

View Postpoon, on Jul 26 2008, 06:54 AM, said:

i get this in my specials page
That is because the same fix has to be applied to catalog/includes/classes/split_page_results.php.
Read the first post again.

#263 poon

  • Community Member
  • 14 posts
  • Real Name:Ricky Poon

Posted 26 July 2008, 17:59

View PostJan Zonjee, on Jul 26 2008, 03:55 AM, said:

That is because the same fix has to be applied to catalog/includes/classes/split_page_results.php.
Read the first post again.


thanks got it....

#264 telry

  • Community Member
  • 1 posts
  • Real Name:telry

Posted 30 July 2008, 22:41

TOO BAD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I how to do fix my page???? 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 'where p.products_status = '1' and pd.products_id = p.products_id and pd.language' at line 1

select count(p.products_id) as total from ((products p, products_description pd, manufacturers m ) left join specials s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '17'

[TEP STOP]


#265 kustomjs

  • Community Member
  • 282 posts
  • Real Name:Tim Reichhart

Posted 05 August 2008, 05:25

Well can anybody help me with these errors i got under admin then under customers?

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

limit 0, 20

then I got error under catalog like this:

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

select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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 from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials s on p.products_id = s.products_id, products_to_categories p2c 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 p2c.categories_id = '21' order by pd.products_name limit , 20

I did that fix what was listed on 1st page that didnt fix it.

also I wanted to add in my server info for anybody so they can help me:
Server OS: Linux 2.6.24-19-server Database: MySQL 5.0.51a-3ubuntu5.1
Server Date: 08/05/2008 01:27:33 Datebase Date: 08/05/2008 01:27:33
Server Up Time: 01:27:33 up 17 days, 11:16, 0 users, load average: 0.00, 0.00, 0.00
HTTP Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.3 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g mod_perl/2.0.3 Perl/v5.8.8
PHP Version: 5.2.4-2ubuntu5.3 (Zend: 2.2.0)

Edited by kustomjs, 05 August 2008, 05:28.


#266 shawn6688

  • Community Member
  • 12 posts
  • Real Name:shawn Dragon

Posted 07 August 2008, 05:54

Hi
When I migrate one site which is run on old version MySQL, version 3.23, to a new MySQL vesion5.0, I got the following error. The scrip works fine the old version MySQL, but not the new one.

1054 - Unknown column 'a.authors_id' in 'on clause'

select a.articles_id from articles a, articles_to_topics a2t left join topics_description td on a2t.topics_id = td.topics_id left join authors au on a.authors_id = au.authors_id, articles_description ad where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_id = a2t.articles_id and a.articles_status = '1' and a.articles_id = ad.articles_id and ad.language_id = '1' and td.language_id = '1' and a.articles_date_added > SUBDATE(now( ), INTERVAL '30' DAY)


I am new to this. Please help me here.

#267 tsturdivant

  • Community Member
  • 16 posts
  • Real Name:T.
  • Location:TN

Posted 20 August 2008, 23:06

THANK YOU!

This trick fixed all of my problems in the admin and catalog!

#268 amenone

  • Community Member
  • 5 posts
  • Real Name:Joe

Posted 27 August 2008, 15:21

I've searched through this forum and applied the original fix, but it didn't help my problem. I hope somebody can look at this and see where I've made a mistake! Thanks so much to everybody for being so supportive.

I receive this error when trying to edit a product under admin:

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 'on p.products_id = ptdc.products_id, products_description pd where p.products_id' at line 1

select pd.products_name, pd.products_description, pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_qty_blocks, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id, p.products_free_shipping, ptdc.discount_categories_id from products p, products_to_discount_categories ptdc on p.products_id = ptdc.products_id, products_description pd where p.products_id = '145' and p.products_id = pd.products_id and pd.language_id = '1'

[TEP STOP]

#269 peter4stra

  • Community Member
  • 1 posts
  • Real Name:Peter

Posted 02 September 2008, 17:43

Hello,

Tried the "fix" but nothing helped.

Still getting this 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 'now(),'O:12:"shoppingcart":5:{s:8:"contents";a:1:{i:30;a:1:{s:3:

INSERT INTO TABLE_IDEAL_PAYMENTS (transaction_id, entrancecode, issuer_id, order_id, payment_status, date_last_check,cart_contents) values (0, '5d51bcac5b21016d26d2ed8788f7c6d5',0151,55, ,now(),'O:12:"shoppingcart":5:{s:8:"contents";a:1:{i:30;a:1:{s:3:"qty";s:1:"1";}}s:5:"total";d:1;s:6:"weight";d:0;s:6:"cartID";N;s:12:"content_type";s:8:"physical";}')

[TEP STOP]


This is when the user confirmes the payment.

Google search brings me nowhere but on this forum :blush:

plz help. :huh:

Edited by peter4stra, 02 September 2008, 17:46.


#270 Top_Speed

  • Community Member
  • 357 posts
  • Real Name:KJ Miller
  • Location:SU-ville (Syracuse)

Posted 05 September 2008, 13:36

Hi all,

I only get this in my admin (orders) page when reviewing an invoice that has a product that has been deleted.

Quote

1 x Blue Widget Extreme Size1064 - 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 'and pta.products_text_attributes_id = ota.products_text_attributes_id' at line 1

select ota.*, pta.products_text_attributes_name from orders_text_attributes as ota, products_text_attributes as pta where ota.orders_id = 1890 and ota.products_id = and pta.products_text_attributes_id = ota.products_text_attributes_id

[TEP STOP]

I tried "Simplyeasier" fix but does not work for this.
Thanks for any ideas!
define('PROJECTS', 'Something that goes on forever!');

#271 Xcom82

  • Community Member
  • 1 posts
  • Real Name:Krystian

Posted 25 September 2008, 12:27

Hi all,

I have a bit different error and I get it only when my session in Admin part ends. Here it is:

File: catalog/admin/admin_account.php

When I'm not logged in (ie. login timeout) and try to access the account modification page, I get 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 'and g.admin_groups_id=' at line 1

select a.admin_id, a.admin_firstname, a.admin_lastname, a.admin_email_address, a.admin_created, a.admin_modified, a.admin_logdate, a.admin_lognum, g.admin_groups_name from admin a, admin_groups g where a.admin_id= and g.admin_groups_id=

[TEP STOP]
Note that when i'm logged in, so after i log in again, everything works fine.

Any ideas ?

#272 tavoplus

  • Community Member
  • 3 posts
  • Real Name:Gustavo Da Silva

Posted 25 September 2008, 22:38

Thank you so much, it work perfect!!

GDS ;)

#273 sakwoya

  • Community Member
  • 93 posts
  • Real Name:Eh?

Posted 03 October 2008, 09:09

View PostXcom82, on Sep 25 2008, 01:27 PM, said:

Hi all,

I have a bit different error and I get it only when my session in Admin part ends. Here it is:

File: catalog/admin/admin_account.php

When I'm not logged in (ie. login timeout) and try to access the account modification page, I get the following error:

Note that when i'm logged in, so after i log in again, everything works fine.

Any ideas ?

I've just had this error on an oscMax install - the host server had Register Globals set to 'off' and I had incorrectly applied one of the osC Register Globals patches (I forgot to amend the admin sessions function). Once I applied the patch correctly it all works :rolleyes:

Try adding in a Register Globals fix and see what happens

Graeme

#274 samedayhosting

  • Community Member
  • 3 posts
  • Real Name:Richard Sprankle

Posted 12 October 2008, 17:11

View PostSimplyeasier, on Apr 1 2005, 09:10 AM, said:

Hi

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 :D

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.

:o NOTE - I have NOT asked you to change catalog/includes/classes/split_page_results.php - If you have a problem on the catalog side you may want to try the same change in that file - I did and it went wrong so the change to my catalog/includes/classes/split_page_results.php file is a little more elaborate and I will share that here if it becomes an issue - but for now it seems people will mostly have a problem with empty files on the admin side.

Change (catalog/includes/classes/split_page_results.php around line 67) 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;

Both on the catalog side and the admin side changing $offset to max($offset, 0) is the "official" fix.

hth

Charles


Hi,

I used your fix which worked great for one of the two errors i have, can you tell me how to fix this error, this error list below only shows up when i want to edit a product from the admin side ONLY.. No error on the catalog side???????????

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 'from products p, products_description pd where p.products_id = '185' and p.produ' at line 1

select p.products_name, p.products_description, p.products_url, p.products_keywords, p.products_metadescription, p.products_pagetitle, p.products_id, p.products_quantity, p.products_model, p.products_image, p.product_image_2, p.product_image_3, p.product_image_4, p.product_image_5, p.product_image_6, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id, from products p, products_description pd where p.products_id = '185' and p.products_id = pd.products_id and pd.language_id = '1'


Thank you

#275 BuddahBoy

  • Community Member
  • 240 posts
  • Real Name:Ron

Posted 08 November 2008, 14:25

Endless thanks for this quick and effective fix - the wonders of the excellent assistance and support found in these forums always amazes me anew - I am eternally grateful to all those who take of their own time to help me find solutions to problems over the years - - Bess You All

#276 teckvo00

  • Community Member
  • 1 posts
  • Real Name:Henry

Posted 21 November 2008, 19:29

hi everyone i need help with this error
-Home <----error at here
-Category 1
----Sub 1
----Sub 2
-------Sub 1 <----- error at here
-------Sub 2 <----- error at here

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

SELECT `manufacturers_name` FROM `manufacturers` WHERE manufacturers_id =

[TEP STOP]


can anyone help please, thanks?

#277 etech97

  • Community Member
  • 28 posts
  • Real Name:Thomas Rehill

Posted 30 November 2008, 04:36

Thanks a lot Man!!!!!!! Your fix worked Great. I deleted all of the Manufacturers and was getting that error message, now everything works :D

Tom

#278 veteranodf

  • Community Member
  • 2 posts
  • Real Name:Ariel
  • Gender:Male

Posted 03 December 2008, 21:57

Erro 1064

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 '(pd.products_name like '%e%' or p.products_model like '%e%' or m.manufacturers_n' at line 1

select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%a%' or p.products_model like '%a%' or m.manufacturers_name like '%a%')(pd.products_name like '%e%' or p.products_model like '%e%' or m.manufacturers_name like '%e%')(pd.products_name like '%a%' or p.products_model like '%a%' or m.manufacturers_name like '%a%') )


Solution please?

#279 usvi4me

  • Community Member
  • 127 posts
  • Real Name:Letty

Posted 04 December 2008, 14:19

MYSQL QUERY ERROR REPORT
---------------------------------------
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 ''78'')' at line 1

INSERT INTO products_to_products_extra_fields (products_id, products_extra_fields_id, products_extra_fields_value) VALUES ('163', '99', '78'')

Anyone ?

#280 fishgal2

  • Community Member
  • 3 posts
  • Real Name:Fryan

Posted 09 December 2008, 17:14

hi, i'm not sure how to install the world zone addon from http://addons.oscommerce.com/info/1792. I go to phpMyAdmin >mydatabase. And i try to import the .sql file and i got the error below:

MYSQL QUERY ERROR REPORT
---------------------------------------
#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 '' at line 1

DROP TABLE IF EXISTS zones;
CREATE TABLE zones (
zone_id int NOT NULL auto_increment,
zone_country_id int NOT NULL,
zone_code varchar(32) NOT NULL,
zone_name varchar(56) NOT NULL,
PRIMARY KEY (zone_id)
);


1. Not sure this is the correct way to import .sql file.
2. do i need to drop the zone table first?
3. what should i do now?
4. Beside replacing this sql file, do i still need to change any coding on other php?

Please anyone kindly to help/guide me. Thanks.

Edited by fishgal2, 09 December 2008, 17:15.