Re: Class ADODB - Method GenID() in MySQL

From: Date: Wed, 19 Jul 2006 13:47:18 +0000
Subject: Re: Class ADODB - Method GenID() in MySQL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-239571@lists.php.net to get a copy of this message
Renne Rocha wrote:
Hello, I am using the ADODB class to connect to a MySQL server. I am trying to generate an ID with the method GenID(), but when I tried this: $id = $db->GenID('table'); The value of $id is equal to zero. I know that MySQL doesn't use sequences like PostgreSQL does (I've used this code in a PostgreSQL project), but in the documentation of ADODB I saw that it is possible to use it. Is there any trick about how to make it work? Thanks.
Okay, I'd have to ask at this point what are you using the ID for? If you're generating it for an insert, just put null on the primary key if it's auto-increment and MySQL will do it for you.

« previous php.general (#239571) next »