Reputation: 551
I am trying to insert a row into a table in mysql.This should be simple, but for some reason I'm getting an unexpected response. This is the query I am trying to execute:
INSERT INTO users (username, email, password) VALUES (testuser, testuseratdomaincom, testpass)
My table looks like so: http://pastebin.com/RmLZHWW8
However, when I run the query I get this response:
Failed to execute SQL : SQL INSERT INTO users (username, email, password) VALUES (testuser, testuseratdomaincom, testpass) failed : Unknown column 'testuser' in 'field list'
It's trying to find a column called 'testuser' which should be the value for the username column. What is going on?
Upvotes: 0
Views: 30
Reputation: 3537
You should put your values in quotes.
INSERT INTO users (username, email, password) VALUES ('testuser', 'testuseratdomaincom', 'testpass');
Upvotes: 0
Reputation: 2529
You need to quote your values like 'testuser'. Your current query searches for a field 'testuser' in the table 'users' for inserting it into 'username'.
Correct query:
INSERT INTO users (username, email, password) VALUES ('testuser', 'testuseratdomaincom', 'testpass')
Upvotes: 1