Jump to content

sql issues, please help


darkcarnival

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/7434-sql-issues-please-help/
Share on other sites

[!--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.
Link to comment
https://forums.phpfreaks.com/topic/7434-sql-issues-please-help/#findComment-27080
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/7434-sql-issues-please-help/#findComment-27118
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.