X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9E5E1D1B1F8 for ; Sun, 11 Jul 2004 20:42:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11981-09 for ; Sun, 11 Jul 2004 23:42:42 +0000 (GMT) Received: from beta.interspire.com (unknown [210.215.130.98]) by svr1.postgresql.org (Postfix) with ESMTP id C2CBCD1B1D0 for ; Sun, 11 Jul 2004 20:42:37 -0300 (ADT) Received: from [192.168.0.13] (helo=chris) by beta.interspire.com with esmtp (Exim 3.35 #1 (Debian)) id 1BjniU-0004hX-00; Mon, 12 Jul 2004 09:26:42 +1000 From: "Chris" To: "'Elijah O. Alcantara'" , Subject: Re: wouldn't insert Date: Mon, 12 Jul 2004 09:42:23 +1000 Message-ID: <001601c467a0$be3291f0$0d00a8c0@chris> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 In-Reply-To: <1089340768.18180.9.camel@Falcon> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/11 X-Sequence-Number: 2836 Hey, echo out $query2 before it runs, try a few in psql and it should tell you what the error is.... Chris. -----Original Message----- From: pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org] On Behalf Of Elijah O. Alcantara Sent: Friday, July 09, 2004 12:39 PM To: pgsql-php@postgresql.org Subject: [PHP] wouldn't insert Hi again, Can someone help me out on this? the function I quoted below is supposed to restore the values from table temp_contactinfo to contactinfo. But it's not inserting to the contactinfo table... There are no errors whatsoever, must be something wrong with the logic somewhere... > function restore_contactinfo($connectGovPH, $ctrl_no) { > > $query_clear = "delete from contactinfo where ctrl_no = '$ctrl_no'"; > pg_Exec($connectGovPH,$query_clear); > > $query = "select * from temp_contactinfo where ctrl_no = '$ctrl_no'"; > $result = pg_Exec($connectGovPH,$query); $num = pg_NumRows($result); > > > for($i=0;$i<$num;$i++) { > $row = pg_Fetch_Object($result,$i); > $category = $row->category; > $contact_no = $row->contact_no; > $contact_name = $row->contact_name; > $organization_name = $row->organization_name; > $address = $row->address; > $telephone = $row->telephone; > $fax = $row->fax; > $email = $row->email; > > $query2 = "INSERT INTO contactinfo > VALUES('$ctrl_no','$category','$contact_no','$contact_name','$organizati on_name','$address','$telephone','$fax','$email')"; > pg_Exec($connectGovPH,$query2); > > $query3 = "DELETE FROM temp_contactinfo WHERE ctrl_no = > '$ctrl_no' AND category = '$category' AND contact_no = '$contact_no'"; > pg_Exec($connectGovPH,$query3); > } > } I've searched and searched but couldn't find anything wrong with the code =( Elijah ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match