Re: id field error

From: Surojit Niyogi <surojit(at)bungeecode(dot)com>
To: angelo(dot)rigo(at)globo(dot)com
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: id field error
Date: 2002-04-26 22:05:43
Message-ID: 3CC9CF37.1090602@bungeecode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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(dot)rigo(at)globo(dot)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
>
>
>
>

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Surojit Niyogi 2002-04-26 22:19:43 Re: printer friendly version
Previous Message Surojit Niyogi 2002-04-26 22:05:26 Re: id field error