pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Surojit Niyogi <surojit@bungeecode.com>
To: angelo.rigo@globo.com
Cc: pgsql-php@postgresql.org
Subject: Re: id field error
Date: Fri, 26 Apr 2002 17:05:26 -0500
Message-ID: <3CC9CF26.2090004@bungeecode.com> (raw)
References: <3CC7A89800004414@nplex.globo.com>

You can either use the datatype "SERIAL" or if you have a way of 
generating unique IDs based off of microtimes, you can get away with 
putting a unique value into field "id" as it is right now.

Roj Niyogi
pgHoster
PostgreSQL web hosting

angelo.rigo@globo.com wrote:

>Hi !
>I´m doing my first publishing system for a last aquired boooks for a library.
>
>the problem begin in the id field, wich i choose to be primary key and unique.
>i could just insert data one time the others give me this error:
>
> Cannot insert a duplicate key into unique index biblioteca_pkey
>
>i use this piece of code below to insert the data:
>
>$query = "INSERT INTO biblioteca (id, autor, titulo, editora) values ('$id',
>'$autor', '$titulo', '$editora')";
>$result = pg_exec($db, $query);
>
>may i can alter the id collumn and the query to insert the data anybody
>knows what exactly to do ?
>
>Thank´s
>
>Ângelo
>
>
>
>
>________________________________________
>A busca mais veloz e precisa da internet. Acesse agora: http://www.zoom.com.br.
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>
>  
>





view thread (4+ messages)  latest in thread

Message-ID: <3CC9CF26.2090004@bungeecode.com>
Permalink:  ../3CC9CF26.2090004@bungeecode.com/
Also on:    postgresql.org/message-id/3CC9CF26.2090004@bungeecode.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: surojit@bungeecode.com, angelo.rigo@globo.com
  Subject: Re: id field error
  In-Reply-To: <3CC9CF26.2090004@bungeecode.com>
  References: <3CC7A89800004414@nplex.globo.com> <3CC9CF26.2090004@bungeecode.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox