[PHP] MYSQL 5 auto increment not working

2009-05-21 Thread Leidago !Noabeb
Hi All


I know this is not strictly a PHP question, but i have a problem whenever i
insert a record using PHP. Basically the auto increment field does not work
at all. Here's the structure of the table that i'm using:

CREATE TABLE `children` (
  `cid` int(4) NOT NULL auto_increment,
  `cname` char(50) default NULL,
  `csname` char(50) default NULL,
  PRIMARY KEY  (`cid`)
) ENGINE=InnoDB

I use PHP 5.1 and MYSQL 5

I'm pretty sure the code i use to insert the data is sound since i've tested
it with older versions of MYSQL.

Has anyone else had similar problems?


Re: [PHP] MYSQL 5 auto increment not working

2009-05-21 Thread Bruno Fajardo
2009/5/21 Leidago !Noabeb leid...@googlemail.com

 Hi All


 I know this is not strictly a PHP question, but i have a problem whenever i
 insert a record using PHP. Basically the auto increment field does not work
 at all. Here's the structure of the table that i'm using:

 CREATE TABLE `children` (
  `cid` int(4) NOT NULL auto_increment,
  `cname` char(50) default NULL,
  `csname` char(50) default NULL,
  PRIMARY KEY  (`cid`)
 ) ENGINE=InnoDB

 I use PHP 5.1 and MYSQL 5

 I'm pretty sure the code i use to insert the data is sound since i've
 tested
 it with older versions of MYSQL.

 Has anyone else had similar problems?


Did you left empty the field `cid` (PK) in your INSERT statement?


Re: [PHP] MYSQL 5 auto increment not working

2009-05-21 Thread Per Jessen
Leidago !Noabeb wrote:

 Hi All
 
 I know this is not strictly a PHP question, but i have a problem
 whenever i insert a record using PHP. Basically the auto increment
 field does not work at all. Here's the structure of the table that i'm
 using:
 
 CREATE TABLE `children` (
   `cid` int(4) NOT NULL auto_increment,
   `cname` char(50) default NULL,
   `csname` char(50) default NULL,
   PRIMARY KEY  (`cid`)
 ) ENGINE=InnoDB
 
 I use PHP 5.1 and MYSQL 5

I've just tried creating that table and doing a few inserts - works just
fine here - mysql 5.0.26.


/Per


-- 
Per Jessen, Zürich (26.7°C)


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