pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Raymond O'Donnell <rod@iol.ie>
To: hatem gamal elzanaty <hatem@softpro.bz>
Cc: pgsql-php@postgresql.org
Subject: Re: crud application please help
Date: Mon, 16 May 2011 08:13:38 +0100
Message-ID: <4DD0CEA2.5020001@iol.ie> (raw)
In-Reply-To: <4DD089AF.50104@softpro.bz>
References: <4DD089AF.50104@softpro.bz>

On 16/05/2011 03:19, hatem gamal elzanaty wrote:
> hi,
> can you please guide me in a crud application for one table that have
> auto increment serial number for each record can you please give what
> syntax do i have to enter new record without writing manually the id of
> the record through php connection to postgresql if you can send me an
> example for one table with two fields it would be more than enough i
> would appreciate if you gave me a link , book name , tutorial web site

Auto-incrementing columns, or SERIAL types [1]:

http://www.postgresql.org/docs/9.0/static/datatype-numeric.html#DATATYPE-SERIAL

Default values - look for the DEFAULT keyword:

http://www.postgresql.org/docs/9.0/static/sql-createtable.html

[1] Note that SERIAL isn't a real type, but just syntactic sugar that 
creates a sequence and sets the column to pull from the sequence by 
default. More on sequences:

http://www.postgresql.org/docs/9.0/static/sql-createsequence.html

Ray.

-- 
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie



view thread (2+ messages)

Message-ID: <4DD0CEA2.5020001@iol.ie>
Permalink:  ../4DD0CEA2.5020001@iol.ie/
Also on:    postgresql.org/message-id/4DD0CEA2.5020001@iol.ie

 · 

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: rod@iol.ie, hatem@softpro.bz
  Subject: Re: crud application please help
  In-Reply-To: <4DD0CEA2.5020001@iol.ie>
  References: <4DD089AF.50104@softpro.bz> <4DD0CEA2.5020001@iol.ie>

* 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