Help - Search - Members - Calendar
Full Version: Mysql Error
MoneyMakerGroup > Other Ways To Earn Online > Webmaster Hangout > Webmaster Discussion


voice0fnation
Hi to every one!

Well.. I don't understand why i m getting this error when I want to register a new site on my monitor site..

"Error in SQL query. Cannot add program. Please contact with administrator. MySQL: Column count doesn't match value count at row 1 return"

Any help would be very kind smile.gif
melkor
Let's see your site. What's the url?
voice0fnation
QUOTE(melkor @ Apr 18 2006, 11:49 AM) [snapback]1907057[/snapback]

Let's see your site. What's the url?


Hmmm!!
That is www.paidhyips.com
voice0fnation
Any body would like to give some help?? rolleyes.gif
hyiper_
QUOTE(voice0fnation @ Apr 18 2006, 12:11 AM) [snapback]1907814[/snapback]

Any body would like to give some help?? rolleyes.gif"Error in SQL query. Cannot add program. Please contact with administrator. MySQL: Column count doesn't match value count at row 1 return"

Yeah it means that mySql is expecting another row thats not there.

Tried to remember what I did to fix mine, can't...sorry. Surely one of these Pro's know though...

Good luck
voice0fnation
QUOTE(hyiper.org @ Apr 18 2006, 09:47 PM) [snapback]1910474[/snapback]

Yeah it means that mySql is expecting another row thats not there.

Tried to remember what I did to fix mine, can't...sorry. Surely one of these Pro's know though...

Good luck



Ohhh!! You got to recall man!
Don't know how to manage this problem! sad.gif
hyiper_
QUOTE(voice0fnation @ Apr 18 2006, 08:45 AM) [snapback]1910892[/snapback]

Ohhh!! You got to recall man!
Don't know how to manage this problem! sad.gif

My statement was wrong about not enough fields, opposite is true, I found this, hope it helps smile.gif

How to fix " Invalid Query: Column Count Doesn't Match Value Count At Row 1 " error in MySQL

Every time we use MySQL, particularly with perl or php, here at HTMLfixIT.com (that means Franki and Don) we come to like it more. The power and flexibility provided allow some great opportunities for interactive programming. Unfortunately, anytime you do something, you find errors do creep up.
One common error in MySQL is this: Invalid Query: Column Count Doesn't Match Value Count At Row 1.
Fortunately this one is easy to fix!

Avoid False Assumptions.

When I first encountered this error, I made the false assumption that I had too few columns in the table in my database to receive the data being posted. In fact, the opposite was true. My query was posting too few items for the columns. A common mistake (especially for beginners, but for the deadline pressed expert as well) is to forget the unique id number, shown in red below, when posting the query. If you have an auto-incrementing id number for each row, you will do well to include an empty set of quotes to match in your query. So it might look like this:
$query = "INSERT INTO table (id, first_name, last_name)
VALUES('','$_POST[first_name]','$_POST[last_name])";
Don´t Add Data Columns.

Because phpMyAdmin, for example, makes it so easy to modify data tables on the fly in MySQL, many designers make the mistake of adding columns after the fact without thought or deleting the extra ones (Don does this all the time) while more careful designers carefully layout the project and required fields in advance, leaving a field or two extra for future adjustment (you guessed it ... Franki). If you add or subtract a field, then all queries posting a row of data may have to be modified to match.
Make Sure the Column Names Each Have a Matching Value and Vice Versa.

Make sure you don´t forget one or the other of the value or column name.
Good:
$query = "INSERT INTO table (id, first_name, last_name)
VALUES('','$_POST[first_name]','$_POST[last_name])";
Bad:
$query = "INSERT INTO table (first_name, last_name)
VALUES('','$_POST[first_name]','$_POST[last_name])";
Bad:
$query = "INSERT INTO table (id, first_name, last_name)
VALUES('$_POST[first_name]','$_POST[last_name])";
Because each of these bad examples is missing a corresponding part. If you check off the few things mentioned here, you will have your problems sorted in no time. Don´t give up, get mad and conquer.
Joey85
You dont actually need to even include your auto-increment values in an insert statement though, Mysql deals with that for you.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.