If this is your first visit, check our documentation. To post, register or login.
Forums / Basic Configuration / You have an error in your SQL syntax???

You have an error in your SQL syntax???

Locked

Started by sjoukito on 4 Feb 2013, 9:21 PM · Views: 2,529

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
4 Feb 2013, 9:21 PM
#1
sjoukito avatar

sjoukito

New Zenner

Join Date:
Jul 2011
Posts:
17
Plugin Contributions:
0

You have an error in your SQL syntax???

Hey everyone,

I just installed a new version of zencart 1.5.1. but I am getting this error:

[04-Feb-2013 20:55:59 UTC] PHP Fatal 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 'int)PRODUCTS_OPTIONS_VALUES_TEXT_ID, 3, 'TEXT')' at line 1 :: INSERT INTO products_options_values (products_options_values_id, language_id, products_options_values_name) VALUES ((int)PRODUCTS_OPTIONS_VALUES_TEXT_ID, 3, 'TEXT') in ../public_html/ws54/includes/classes/db/mysql/query_factory.php on line 120

At the time I got this problem I installed these mod's:

Dutch Language Pack ZC 1.3.9 and 1.5.0
Image_Handler4_v4_0
Zen lightbox
Admin_Login_As_Customer_v3.1_For_ZCv151
css_js_loader
fec
sales_report_graphs_v1.04
Monthly_Sales-Tax_Summary-v1.4
edit_orders_v4.0.4

Also I transferred my database but only the customer/order related tables and the product/categories related data. I first made an update of my database 1.9.3 and then started to replace parts of the original 1.5.1 database with it.

After a while everything worked well and I was quite pleased with it, until I wanted to ad an attribute to one of my products and I got this message.

WARNING: An Error occurred, please refresh the page and try again.

The same happens when I go to the option name manager, option value manager etc.

I tried to solve the problem but no luck!

does anyone know how to solve this thing?

4 Feb 2013, 9:31 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: You have an error in your SQL syntax???

Also I transferred my database but only the customer/order related tables
You should import a current "COMPLETE" databse and re-run zc_install and select upgrade database only

Zen-Venom Get Bitten

5 Feb 2013, 5:24 AM
#3
sjoukito avatar

sjoukito

New Zenner

Join Date:
Jul 2011
Posts:
17
Plugin Contributions:
0

Re: You have an error in your SQL syntax???

kobra:

You should import a current "COMPLETE" databse and re-run zc_install and select upgrade database only

Well that's not really an option as my old database is completely messed-up (I mean really messed up), now everything works fine except for this error and I'm not sure if its really the database that's responsible for the error.

5 Feb 2013, 10:24 PM
#4
sjoukito avatar

sjoukito

New Zenner

Join Date:
Jul 2011
Posts:
17
Plugin Contributions:
0

Re: You have an error in your SQL syntax???

Ok, I am one step closer to solving the problem.

Hopefully someone can help me because I really need to get the new website online since the upcoming season will be the most important one for us.

When I imported the database as described in my previous post, I did not see any of the products at first.
Then I found out that the products are loaded based on the languages_id. In my old database that was language id 4, foolishly I had deleted every language except the Dutch one. In my new database I had id number 3 for Dutch. As I only had the product descriptions etc. in Dutch I changed the id number for Dutch to 4. This solved all the problems I had and the products showed up quite nicely.

Later however, I found out that none of the product attribute options are working, except for "Option Name Sorter" and "Option Value Sorter" which are new to 1.5.1 and therefore are still linked to the id number for English from the new installation.

Today I simply transferred the whole database from this new installation to a clean installation of zencart, the basic language being English. When I use the English admin control, add a product etc. all attribute options are working, once I switch to the Dutch language in the admin the same problems occur.

The error message I get says that it is trying to:

INSERT INTO products_options_values (products_options_values_id, language_id, products_options_values_name) VALUES ((int)PRODUCTS_OPTIONS_VALUES_TEXT_ID, 3, 'TEXT') in ../public_html/ws54/includes/classes/db/mysql/query_factory.php on line 120

so its doing something with language id number 3 instead of 4. But where does it get this 3 from, or maybe the question should be: why is it trying to use language id 3 (for English) for an attribute with language id 4?

So what is going on, I'm really lost here.

Ps the link to the new site at this moment is: www. plantmania .nl /ws2 (delete spaces)

6 Feb 2013, 6:47 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: You have an error in your SQL syntax???

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.