From: | "Chris" <chris(at)interspire(dot)com> |
---|---|
To: | "'Elijah O(dot) Alcantara'" <elijah(at)asti(dot)dost(dot)gov(dot)ph>, <pgsql-php(at)postgresql(dot)org> |
Subject: | Re: wouldn't insert |
Date: | 2004-07-11 23:42:23 |
Message-ID: | 001601c467a0$be3291f0$0d00a8c0@chris |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
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(at)postgresql(dot)org
[mailto:pgsql-php-owner(at)postgresql(dot)org] On Behalf Of Elijah O. Alcantara
Sent: Friday, July 09, 2004 12:39 PM
To: pgsql-php(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Elijah O. Alcantara | 2004-07-12 01:45:33 | Re: wouldn't insert |
Previous Message | brew | 2004-07-09 19:08:12 | Re: wouldn't insert |