MySQL is returning a syntax error for this query (via PHP):
INSERT INTO links (link, name, desc, category)
VALUES ('www.contoso.com', 'Contoso', 'My Website', 'Vanity')
ERROR:
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 ‘desc, category) VALUES (‘www.contoso.com’, ‘Contoso’, ‘My Website’, ‘Vani’ at line 1
I see nothing wrong with it. What gives?
DESC is a MySQL reserved word… if you want to use it as a column name you must enclose it in backticks
The actual error message after the word “near” gives an indication of exactly where in your SQL statement the parser believes the error to be… in this case, at the word “desc”. That can often be a good guide to diagnosing the problem.