I am trying to do an INSERT statement. It is giving me an 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 'Telecaster’, 599.00)' at line 1

Here is the statement: INSERT INTO gtr_shop1_products (categoryID, productCode, productName, listPrice) VALUES (1, ‘tele’, ‘Fender Telecaster’, 599.00);

What am I doing wrong?

Recommended Answers

All 3 Replies

Hello - I'm not sure what your db looks like, but you if your CategoryID is set as Auto-Increment you don't have to include it in your statement. I like to test my sql in something like Sql Query Browser before I try it in my application. Hth.

when you exectute this query in php then write in this way
mysql_query("//Your query goes here") or die(mysql_error());
this will give you exact error. do this and let me know what error is being reported

Hi:
    Your query syntax working fine you made small mistake when using symbol ' instesd of this symbol you used some other symbols  
    I changed the your syntax check with thatm 
     INSERT INTO gtr_shop1_products (categoryID, productCode, productName, listPrice) VALUES (1, 'tele', 'Fender Telecaster', 599.00);     
     this is working fine
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.