Re: pg_prepare()/pg_execute() and pg_query_params()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Then you should put some debugging around the connection code.

|$pgconn = pg_connect("host=localhost port=5432 dbname=test user=test password=test")| or die("Problem with connection to PostgreSQL: ".pg_last_error());

So you can be sure that you are really connected. Also you can use pg_result_error()...

$result = pg_query_params($pgconn, $update, array($foo, $bar));
echo pg_result_error($result);

or even pg_result_error_field().


Brandon Metcalf napsal(a):
b == brandon@xxxxxxxxxxxxxxxxxx writes:

 b> I'm fairly new to PHP but have a great deal of Perl experience for
 b> what it's worth.  I'm having a problem where if I try to use a
 b> parameterized query it fails but pg_last_error() returns nothing.  For
 b> example,

 b>   $result = pg_query_params($pgconn, $update, array($foo, $bar));

 b>   if (! $result) {
 b>       fwrite($fp, "before");
 b>       fwrite($fp, pg_last_error());
 b>       fwrite($fp, "after");
 b>   }


I should also mentioned with

  log_statement = 'all'

in postgresql.conf, nothing is dumped to the logs.  This tells me
pg_query_params() isn't passing anything to the postgres server.


--

S pozdravem

Daniel Tlach
Freelance webdeveloper

Email: mail@xxxxxxxxxxxx
ICQ: 160914875
MSN: danaketh@xxxxxxxxxxx
Jabber: danaketh@xxxxxxxxx


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux