Help with query

I have a database for my classified ads for our club. I have the structure as follows:

Classified_ID int(11)
Name varchar(40)
Address1 varchar(35)
Address2 text
City varchar(35)
State varchar(3)
ZipCode int(5)
PhoneNumber varchar(12)
Member int(1)
Ad_Type varchar(10)
Subject_Title text
Ad_Content text
Date_Submitted date
Duration int(2)
Active int(1)
adEmail varchar(35) Yes

Now, I have a query to insert into this database, but it fails and I cannot figure out why.

query to insert:
INSERT INTO Classified (‘Name’, ‘Address1’, ‘City’, ‘State’, ‘ZipCode’, ‘adEmail’, ‘PhoneNumber’, ‘Member’, ‘AdType’, ‘Ad_Content’, ‘Date_Submitted’, ‘Duration’, ‘Active’) VALUES (‘richerd’, ‘9876’, here’, ‘WA’, ‘99217’, ‘’, ‘508-555-1212’, ‘0’, ‘Wanted’, ’ wanting something’, ‘04-16-2012’, ‘3’, 1)

Failure message:
Data did not get inserted into Participant table - 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 '‘Name’, ‘Address1’, ‘City’, ‘State’, ‘ZipCode’, ‘adEmail’, ‘PhoneNumber’, ‘Membe’ at line 1

Please let me know what I am doing wrong.

Oh, PHP version is 5.2.17 just in case you were going to ask…


the relevant syntax is

INSERT INTO tablename ( [I]list of columns[/I] ) VALUES ( [I]list of values[/I] )

instead of a list of columns, you have a list of strings

mysql’s backtick, the spawn of the devil, pwns yet another developer!!

Ah, yes. Used the wrong “marker”.

However, begs the question, are the backticks really needed? And, why does phpmyadmin put them in? Just to confuse us that learn by “example”??

Thanks and it is now working.


phpmyadmin puts them in because you didn’t turn that option off :slight_smile:

backticks are not needed if you remember never to put a special character (like a space or number sign) into a table or column name, or use a reserved word (like order) for a table or column name