Reputation: 41
The query syntax is as follows:
INSERT INTO sent (username,password) VALUES
('user','user2','user3','user4','user5','user6'),
('pass','pass2','pass3','pass4','pass5','pass6')
Resource: http://dev.mysql.com/doc/refman/5.5/en/insert.html
The mysql_error() always showing me this:
Column count doesn't match value count at row 1
I have no idea what should I do. Now it's time to ask you about this.
Upvotes: 0
Views: 28
Reputation: 42083
You specified 2 columns with 6 values. The number of columns and values has to match. What you want is this:
INSERT INTO sent (username,password) VALUES ('user','pass'),('user2','pass2'),('user3','pass3'),('user4','pass4'),('user5','pass5'),('user6','pass6')
See the MySQL documentation for more details:
INSERT statements that use VALUES syntax can insert multiple rows. To do this, include multiple lists of column values, each enclosed within parentheses and separated by commas. Example:
INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
Upvotes: 2