Re: Error #1136

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, August 24, 2005 11:42 am, George B wrote:
> Column count doesn't match value count at row 1
>
> What does that mean? I have an id auto_increment and it breaks
> everytime
>   because of that error. This has never happend before...

If you REALLY don't want to specify all the column names (as suggested
by others) you *CAN* use NULL for the auto_increment field value, and
MySQL will do the right thing.

create table example (
  example_id int(11) unsigned auto_increment unique not null primary key,
  example text
);

INSERT INTO example VALUES (NULL, 'This is an example.');

It's probably better to get in the habit of specifying columns,
though, because eventually you'll have tables where only SOME columns
are known at the time of the initial INSERT, and others will be
UPDATEd later, or not at all, depending on the application.

So you *CAN* do this, but I'm recommending that you don't.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux