On Mon, August 7, 2006 6:48 am, Erik Gyepes wrote:
> I'm trying to learn using PDO and PostgreSQL together a little bit and
> I
> have some problems with (I thinks, auto incrementing fields)
> I have the following sample DB:
>
> CREATE TABLE users (
> uid SERIAL UNIQUE NOT NULL,

My PostgreSQL knowledge is very out-dated, but I always used to have
to do:

create sequence users_id;
create table users (
  uid int4 unique not null primary key default 'nextval(users_id)',

as I recall.

It's quite likely that PostgreSQL added the SERIAL type and I'm just
an old dog...

>    $query = "INSERT INTO users SET uid = :uid, login = :login,
> password
> = :password";

As far as I know, only MySQL actually lets you mangle SQL in that
particular fashion...

insert into users (uid, login, password) values(:uid, :login, :password)

is probably what you want, assuming the :variable is how PDO does things.

You're on your own for the PDO stuff...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to