Friday, January 25, 2019

mysql - Unknown column '0' in 'field list'?





I have the following MySQL query:



INSERT INTO ipi_messages (Message_userID, Message_fromName, Message_fromEmail, Message_subject, Message_body) VALUES(`0`, `hope`, `thisworks@gmail.com`, `i hope`, `this works`)



My database schema is:



enter image description here



I cannot, for the life of me, figure out how that error is even possible. Why would MySQL try to find 0 as one of the columns? It is clearly not even in the column declaration piece of the code.



So why am I getting the error Unknown column '0' in 'field list'?


Answer



You need to use regular quotes ' for string values. Backquotes are used to enclose column and table names.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...