SlyMan Posted October 13, 2014 Share Posted October 13, 2014 Hi Guys, am new to PHP and just got stuck with this error message: Column count doesn't match value count at row 1. The code is this below: $query = "INSERT INTO members(email, name, gender, dob, profile, password, group_ID) SELECT operations.group_ID FROM operations JOIN members ON operations.group_ID = members.group_ID" ; $result = $db->query($query); Am trying to insert data into a table called members, and needs to get the group_ID from another table called operations. Not so sure what is wrong with the code; will appreciate help from anyone. Cheers. Link to comment Share on other sites More sharing options...
niche Posted October 13, 2014 Share Posted October 13, 2014 Do all those columns exist in the target file? Link to comment Share on other sites More sharing options...
SlyMan Posted October 13, 2014 Author Share Posted October 13, 2014 Yes they do exist. Link to comment Share on other sites More sharing options...
niche Posted October 13, 2014 Share Posted October 13, 2014 I don't see mysqli_error() in your code? http://www.w3schools.com/php/func_mysqli_error.asp Link to comment Share on other sites More sharing options...
justsomeguy Posted October 13, 2014 Share Posted October 13, 2014 You're trying to insert 7 columns but the select statement only contains 1 column. List the others out. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now