pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Elijah O. Alcantara <elijah@asti.dost.gov.ph>
To: pgsql-php@postgresql.org
Subject: wouldn't insert
Date: Fri, 09 Jul 2004 10:39:28 +0800
Message-ID: <1089340768.18180.9.camel@Falcon> (raw)

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','$organization_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




view thread (8+ messages)  latest in thread

Message-ID: <1089340768.18180.9.camel@Falcon>
Permalink:  ../1089340768.18180.9.camel@Falcon/
Also on:    postgresql.org/message-id/1089340768.18180.9.camel@Falcon

 · 

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: elijah@asti.dost.gov.ph
  Subject: Re: wouldn't insert
  In-Reply-To: <1089340768.18180.9.camel@Falcon>
  References: <1089340768.18180.9.camel@Falcon>

* 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