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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.