PEAR DB Return Serial
| From: | James Taylor | Date: | Sun, 23 Mar 2003 03:15:59 +0000 |
| Subject: | PEAR DB Return Serial | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4381@lists.php.net to get a copy of this message | ||
Hi everyone, I'm writing a script that inserts data into a postgres
table. The ID column is the primary key, and is just a serial that auto
increments on every insert. I need to know how to get PEAR to return
the value of the inserted ID.
So, say I have something like this:
$data = array(1, 'true');
$sth=$this->db->prepare("insert into customer (id_vendor, status) values
(?,?)");
$r=$this->db->execute($sth,$data);
Say the results of the insert look something like this:
Id | id_vendor | status
23 1 t
I need PEAR to return the number 23 to me without having to do a fetch
query seperately. Anyway to get this?
Thanks