Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 28526B5DBF7 for ; Mon, 16 May 2011 04:13:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 15856-05 for ; Mon, 16 May 2011 07:13:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail1.hosting.digiweb.ie (mail1.hosting.digiweb.ie [89.234.64.49]) by mail.postgresql.org (Postfix) with SMTP id 41148B5DBF6 for ; Mon, 16 May 2011 04:13:42 -0300 (ADT) Received: (qmail 23333 invoked by uid 399); 16 May 2011 07:13:40 -0000 Received: from unknown (HELO ?127.0.0.1?) (ray@teladesign.ie@86.43.79.16) by mail1.hosting.digiweb.ie with SMTP; 16 May 2011 07:13:40 -0000 X-Originating-IP: 86.43.79.16 Message-ID: <4DD0CEA2.5020001@iol.ie> Date: Mon, 16 May 2011 08:13:38 +0100 From: Raymond O'Donnell Reply-To: rod@iol.ie User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: hatem gamal elzanaty CC: pgsql-php@postgresql.org Subject: Re: crud application please help References: <4DD089AF.50104@softpro.bz> In-Reply-To: <4DD089AF.50104@softpro.bz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 110515-1, 15/05/2011), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201105/6 X-Sequence-Number: 4211 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