In trying to learn both php and postgresql as a novice, I am trying to debug a double migration of our old website from php4 to php5 and from postgres 7.4 to 8.3. I am running freebsd 7.0 on two machines and sometimes debugging from a Windows XP. The migrations themselves went fine; now to debug and make them actually work so I can tear this thing apart and rebuild with a new concept, design & implementation.
So far, I am getting this error:

"pg_exec(): supplied argument is not a valid PostgreSQL link resource" in this code (third line -->)

...snip
function SQLQuery( $query ) {
   global $dbh,$curr_row,$result_hash;
   if( !($r=pg_exec($dbh, $query)) ) {
   if (error_reporting()>0) {
echo "<hr>SQL error (".pg_ErrorMessage($dbh).")<br>in ($query) <hr>";
   }
       return 'error';
   }
   $curr_row[$r] = 0;
   $rows=@@pg_numrows( $r );
   if(eregi("insert",$query)) {
   #list($f1,$f2)=split('INTO',strtoupper($query));
   $f=array();
   if(eregi('(.*)into(.*)',$query,$f)) {
       list($tablename,$bullshit)=split("\(",$f[2]);
       $result_hash[$r]=$tablename;
   }
   }
   return $r;
}
snip ...

What, then, is a valid link resource? is it the strings or their content? I have been trying to figure out if pg_exec is valid in postrgres or should it be replaced by another function? There seem to be a number of these functions that are returning the same error... I have also not been able to determine the content of the strings $dbh, $query or most other strings while debugging with eclipse, trying with phped, devphp .... I seem to be connecting to the remote server (freebsd with apache2.2.8 on LAN)

Thanks for any help or suggestions...


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to