Re: PDO and PGSQL: ERROR: syntax error at or near "SET"
| From: | Richard Lynch | Date: | Mon, 07 Aug 2006 22:43:32 +0000 |
| Subject: | Re: PDO and PGSQL: ERROR: syntax error at or near "SET" | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-240293@lists.php.net to get a copy of this message | ||
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