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
On 7/19/06, Renne Rocha [EMAIL PROTECTED] 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
Wouldn't this:
$id = mysql_insert_id();
$query = UPDATE tablename SET id= . ($id + 1);
$result = mysql_query($query);
Be a little simpler.
But like I said, I'm confused over the need for this in the first place,
seeing as how an auto_incremented primary key is self-descriptive. or are
you saving
Yes, using the PHP functions for MySQL, it works. But I am using the
abstraction class ADODB to make the queries in my database. Why?
Probably we will change the database system (probably to PostgreSQL)
and we don want to change all the code to make the things work in the
new BD.
I don't know
Renne Rocha wrote:
Yes, using the PHP functions for MySQL, it works. But I am using the
abstraction class ADODB to make the queries in my database. Why?
Probably we will change the database system (probably to PostgreSQL)
and we don want to change all the code to make the things work in the
Renne Rocha wrote:
Yes, using the PHP functions for MySQL, it works. But I am using the
abstraction class ADODB to make the queries in my database. Why?
Probably we will change the database system (probably to PostgreSQL)
and we don want to change all the code to make the things work in the
-Original Message-
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
John Meyer wrote:
Wouldn't this:
$id = mysql_insert_id();
$query = UPDATE tablename SET id= . ($id + 1);
$result = mysql_query($query);
Be a little simpler.
But like I said, I'm confused over the need for this in the first place,
seeing as how an auto_incremented primary key is
8 matches
Mail list logo