Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

MySQL Column count does not match value count at row 1

mysql

  • Please log in to reply
4 replies to this topic

#1 dink

dink

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 06 September 2008 - 03:09 PM

Hello everyone!
I am new to mysql and php. I do have some knowledge of C++, Java, and ASP.
This is the deal:
I bought the oscommerce for professionals to help with a website I need to create. I downloaded and installed the MySql version 5.01. Installations was successful.

command line prompt per book directions.


mysql> use mysql
database changed

mysql> insert into users values(
--> 'localhost',
-->'username',
-->Password('password'),
-->'Y','Y','Y','Y','Y','Y','Y',
-->'N','N','N','N','N','N','N','N','N','N','N',
-->'N','N','N','N','N','N','N','N','N','N');

RETURNS THIS:
ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql>


I have done some exploring and found out that this means there are more values listed than there are columns in the table.

My question is how do I find out how many columns there are in the table from the command line? This is suppose to an easy exercise just to make sure it works. haha I have been at this for almost 16 hours. I have not even d/l php yet.
Any help would be greatly appreciated!
Thanks in advance,
dink
  • 0

#2 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 06 September 2008 - 03:25 PM

run the command

describe users

for a column specification for table users
  • 1

#3 dink

dink

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 06 September 2008 - 11:54 PM

Thanks orjan!

I could not have done this with out your help. The textbook leaves out a lot of vital information for a newbie.
I finally got it to work by inserting field names and then the values for the fields that did not have default values.
INSERT INTO user
(Host,User,Password,ssl_cipher,x509_issuer,x509_subject) VALUES('localhost','myuser','mypassword','null','null','null');

There is no way I could have found this information on my own. It only took me 30 minutes to figure out the code you posted needed a semicolon to work. haha

Again thanks and I really appreciate your help.
Who knows maybe some day I can help some one.:D
dink
  • 0

#4 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8356 posts

Posted 07 September 2008 - 09:49 AM

+rep, orjan.
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#5 sooshyboy

sooshyboy

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 29 September 2010 - 08:26 AM

Hey, as you can see I'm new here and not sure if anyone will pick up this thread but i have exactly the same problem with exactly the same book! ive tried what orjan said but to no avail... im sure its going to be something simple... but im literally pulling my hair out! Please Help! heres a quick summary of where im at...

first problem... (Same as original post)

command line prompt per book directions.


mysql> use mysql
database changed

mysql> insert into users values(
--> 'localhost',
-->'username',
-->Password('password'),
-->'Y','Y','Y','Y','Y','Y','Y',
-->'N','N','N','N','N','N','N','N','N','N','N',
-->'N','N','N','N','N','N','N','N','N','N');

RETURNS THIS:
ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql>



SO I TRIED... The command

describe users;

and just get this...

Table 'mysql.users' doesn't exist


ARRGGH!

Please Help!
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download