On 2009-01-15, F. <dev001(at)pas-world(dot)com> wrote:
> >Just ignore the default.
> >Have you set up the table with SERIAL?
> >if so this should work:
> After some changes, for the moment seems the good choice.
> But have a problem getting pdo->lastInsertId(), do not work in postgre
> for me.
> I am using this :
> select currval('table_id_seq');
before you insert, and insert the value that gives.
this solves your other problem (use of DEFAULT) too, (or is that the
another option is to use 'RETURNING id' when you insert
INTO "mytable" ( "thatcolumn" )
VALUES ( 'whatever' )
this needs PG >= 8.2
In response to
pgsql-php by date
|Next:||From: Raymond O'Donnell||Date: 2009-01-21 11:53:01|
|Subject: PHP 5.8 -> Postgres on Win2003|
|Previous:||From: F.||Date: 2009-01-15 11:43:30|
|Subject: Re: PREPARE -> EXECUTE Problem|