RE: [PHP-DB] How to autoincrement an autoincrementing field (MySQL)?
| From: | Larry Rivera | Date: | Wed, 02 May 2001 17:45:07 +0000 |
| Subject: | RE: [PHP-DB] How to autoincrement an autoincrementing field (MySQL)? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-9062@lists.php.net to get a copy of this message | ||
What i do is eith not specify the id column or use null as in "" or actually
'' in php, this will enter null which the database then just increments the
field as it should.
Later!
-----Original Message-----
From: Alan Hale [mailto:adhale@bryos.co.uk]
Sent: Wednesday, May 02, 2001 10:29 AM
To: php-db@lists.php.net
Subject: [PHP-DB] How to autoincrement an autoincrementing field
(MySQL)?
OK, I give up - I can't find out how to do this. I thought I'd tracked
it down in my copy of O'Reilly's 2MySQL and mSQL which says that you put
NULL as the value for an autoincrementing, NOT NULL field in an INSERT
statement:
e.g. INSERT INTO records (record_id, name, etc.....) VALUES (NULL,
'Alan', etc.)
which is wierd enough. But it doesn't work (not via PHP mysql_query()
anyhow) - predictably, I get an error 1048 Column 'record_id' cannot be
null.
Help please!
TIA
Alan Hale
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net