Re: PDO and PGSQL: ERROR: syntax error at or near "SET"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux