darkcarnival Posted April 14, 2006 Share Posted April 14, 2006 hi,I'm working on a install program for a program of mine and for some odd reason it will display this error when it tries to insert data into a newly made table.[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Could not add data.Column count doesn't match value count at row 1[/quote]now here is the sql code I'm using:[code]mysql_query("INSERT INTO ebb_groups VALUES('1', 'Administrator', 'These are the people who are in charge. They have full power over the board.', '$user' '1', '1')") or die("Could not add data.<br>". mysql_error());[/code]I am just stumped as to why this wont work, i mean i got this code right from phpmyadmin.any help on this would really be great :)thanks Quote Link to comment https://forums.phpfreaks.com/topic/7434-sql-issues-please-help/ Share on other sites More sharing options...
arifsor Posted April 14, 2006 Share Posted April 14, 2006 [!--quoteo(post=364896:date=Apr 14 2006, 04:00 PM:name=darkcarnival)--][div class=\'quotetop\']QUOTE(darkcarnival @ Apr 14 2006, 04:00 PM) [snapback]364896[/snapback][/div][div class=\'quotemain\'][!--quotec--]hi,I'm working on a install program for a program of mine and for some odd reason it will display this error when it tries to insert data into a newly made table.now here is the sql code I'm using:[code]mysql_query("INSERT INTO ebb_groups VALUES('1', 'Administrator', 'These are the people who are in charge. They have full power over the board.', '$user' '1', '1')") or die("Could not add data.<br>". mysql_error());[/code]I am just stumped as to why this wont work, i mean i got this code right from phpmyadmin.any help on this would really be great :)thanks[/quote]Your are entering 6 values in the table. Are you sure that your table contains 6 column. Quote Link to comment https://forums.phpfreaks.com/topic/7434-sql-issues-please-help/#findComment-27080 Share on other sites More sharing options...
AndyB Posted April 14, 2006 Share Posted April 14, 2006 At the risk of stating the obvious, does your newly created table contain six columns?edit - too slow again :) Quote Link to comment https://forums.phpfreaks.com/topic/7434-sql-issues-please-help/#findComment-27081 Share on other sites More sharing options...
darkcarnival Posted April 14, 2006 Author Share Posted April 14, 2006 yes it does.btw the first col is the id which i set to auto incredment.how about if i list the query that creates the new table:[code]CREATE TABLE `ebb_groups` ( `id` MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT, `Name` varchar(30) NOT NULL default '', `Description` tinytext NOT NULL, `Leader` varchar(25) NOT NULL default '', `Enrollment` tinyint(1) NOT NULL default '0', `Level` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`)) TYPE=MyISAM AUTO_INCREMENT=1[/code]if there is anything wrong there, please let me know.edit: I got it to work, dont ask i just reworded the query and it worked. Quote Link to comment https://forums.phpfreaks.com/topic/7434-sql-issues-please-help/#findComment-27118 Share on other sites More sharing options...
Barand Posted April 15, 2006 Share Posted April 15, 2006 Actually adding 5 values.There's a comma missing between '$user' and '1' Quote Link to comment https://forums.phpfreaks.com/topic/7434-sql-issues-please-help/#findComment-27185 Share on other sites More sharing options...
darkcarnival Posted April 15, 2006 Author Share Posted April 15, 2006 yep i noticed that too later on :oops:, thanks guys its now working :) Quote Link to comment https://forums.phpfreaks.com/topic/7434-sql-issues-please-help/#findComment-27254 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.