Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

1064 - You have an error in your SQL syntax


Simplyeasier

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 354
  • Created
  • Last Reply

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?

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 month later...

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

 

I fixed it thanks!

 

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;

 

if you don't find: $this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;

search for: sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page; and follow instructions above

Link to comment
Share on other sites

  • 2 weeks later...

I have a post for my error but Charles (and others) seem to know this error so seeing if i get a response from here......

 

I was having the standard SQL error of 1054, I applied a fix and all was ok, i have then continued to add further products and still fine. Then after a while with no further contributions added or anything changed apart from products being added, when you click on a catagory (no error if sub catagories are there until you choose one of them) I get the following:

 

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 ') left join specials s on p.products_id = s.products_id where p.products_status ' at line 1

 

select count(p.products_id) as total from (products_description pd, products p) left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c) 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 p2c.categories_id = '132'

 

[TEP STOP]

 

Hopin to get this sorted as apart from a couple of contributions and graphic work this would then be me done on this site and can move onto the next....I thank you all in advance

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

I have a post for my error but Charles (and others) seem to know this error so seeing if i get a response from here......

A. Cross-posting is not allowed on the forum...

 

B.

as total from (products_description pd, products p) left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c) left join specials s

I see one opening parenthesis and two closing (the one after products p looks suspicious). That is giving the error IMHO.

 

You probably made a small mistake when fixing the 1054 error.

Link to comment
Share on other sites

Charles

 

Hello I did exactly what you said and it did not work for me. I have tried every single option in this forum and I could not get the search work. Please help me. My displyed error is:

 

I think your solution does not work with PHP: 5.2.4 and MySQL:5.1.30

 

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 p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.' at line 1

Link to comment
Share on other sites

A. Cross-posting is not allowed on the forum...

 

B.

as total from (products_description pd, products p) left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c) left join specials s

I see one opening parenthesis and two closing (the one after products p looks suspicious). That is giving the error IMHO.

 

You probably made a small mistake when fixing the 1054 error.

 

A) Sorry for cross pointing Jan

 

B) Which file would this code be in?

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

I would assume it to be in index.php.

 

No there is no such code in the index file, which i did not think there would be as the index loads fine.....

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

so am i not allowed to ask for help with this in the general support area, Jan, i did post it there 1st and only added it on here like the a sheep (like others have)

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I got 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 '*) as total from products_to_categories where categories_id = '105'' at line 1

 

select co0unt(*) as total from products_to_categories where categories_id = '105'

 

I tired the tips above but nothing changed. I use mysql 5.0. I have the problem since I deleted all product manufacturer I think. I tired to upload an older database but I got the error again.

Link to comment
Share on other sites

  • 4 weeks later...
Charles

 

Hello I did exactly what you said and it did not work for me. I have tried every single option in this forum and I could not get the search work. Please help me. My displyed error is:

 

I think your solution does not work with PHP: 5.2.4 and MySQL:5.1.30

 

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 p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.' at line 1

 

Hi

 

Did you have any luck with this yet?? I´m in exactly the same situation as you. Every time I try to ue the advanced search 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 'distinct p.products_image, m.manufacturers_id, p.products_id, pd.products_name,' at line 1

 

select pd.products_url, distinct p.products_image, m.manufacturers_id, p.products_id, pd.products_name, 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 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 '%ican%' or p.products_model like '%ican%' or m.manufacturers_name like '%ican%' or pd.products_description like '%ican%') ) order by pd.products_name limit 0, 10

 

I have tried every single fix on this thread at least three times in varying combinations with absolutely no result. This problem materialised after we migrated servers and had to upgrade to php 5/mysql 4.1xx

 

Does anybody have any ideas. Getting desperate now.

 

Many many thanks in advance

 

Terry

Link to comment
Share on other sites

  • 2 weeks later...

Can Anyone help with 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 'option,ordering,admin_menu_img,iscore,params,enabled from bak_co

 

select id,name,link,menuid,parent,admin_menu_link,admin_menu_alt,option,ordering,admin_

menu_img,iscore,params,enabled from bak_components

 

[TEP STOP]

 

 

Need some help

Link to comment
Share on other sites

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 'option,ordering,admin_menu_img,iscore,params,enabled from bak_co

 

select id,name,link,menuid,parent,admin_menu_link,admin_menu_alt,option,ordering,admin_

menu_img,iscore,params,enabled from bak_components

Option is a reserved word in MySQL. Shouldn't be used for a field name...

Link to comment
Share on other sites

  • 4 weeks later...

I am getting 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 '?osCsid=f137a9a63cc07a7c3271394cd0810d8e) and pd.products_id = p.products_id and' at line 1

select count(*) as total from products p, products_description pd where p.products_status = '1' and p.products_id in (22,27,2?osCsid=f137a9a63cc07a7c3271394cd0810d8e) and pd.products_id = p.products_id and pd.language_id = '1'

[TEP STOP]

 

The error comes when someone clicks GoogleCkeckout > and are taken to Google and complete the order > after order complete there is a link to return to my site > when you click that link > above error 1064

 

I am using MySQL: 5.0.75

 

Would the earlier changes apply? thanks...

Link to comment
Share on other sites

My problem is that every time I try to view one of my products, I get an error. Do you think your fix will work for this error? Your opinions are very much welcome. Thanks in advance. 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 ') left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products' at line 23

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, p.products_price, p.products_weight, 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,paf.products_image2, paf.products_image3, paf.products_image4, paf.prod_type, paf.customers_id, paf.direct_contact, paf.products_qty_blocks, paf.products_price1, paf.products_price2, paf.products_price3, paf.products_price4, paf.products_price5, paf.products_price6, paf.products_price1_qty, paf.products_price2_qty, paf.products_price3_qty, paf.products_price4_qty, paf.products_price5_qty, paf.products_price6_qty, paf.products_id_source, paf.products_source_price, paf.products_source_price_multiplier, paf.products_notification_code from products_add_fields paf, products_description pd, products p) left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c) left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = '461' and p.products_id = paf.products_id and pd.products_id = '461' and pd.language_id = '1'

[TEP STOP]

Link to comment
Share on other sites

Do you think your fix will work for this error?

 

The original author doesn't seem to be supporting this thread anymore... his fix did not work for me. It looks like it might work for you though? Just back the indicated files up and try these fixes and see if they work

 

1) http://www.oscommerce.com/forums/index.php?s=&...t&p=1320842

 

and/or

 

2) http://www.oscommerce.com/forums/index.php?s=&...t&p=1114863

 

Good Luck

Link to comment
Share on other sites

Well thanks for the try. I tried and it was a no go. Sadly, there is too much custom code on my OSCommerce, and I don't know where else to go with this... :(

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...