Re: pg_prepare()/pg_execute() and pg_query_params()
| From: | danaketh | Date: | Tue, 26 May 2009 20:38:19 +0000 |
| Subject: | Re: pg_prepare()/pg_execute() and pg_query_params() | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46204@lists.php.net to get a copy of this message | ||
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@geronimoalloys.com 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) {-- S pozdravem Daniel Tlach Freelance webdeveloper Email: mail@danaketh.com ICQ: 160914875 MSN: danaketh@hotmail.com Jabber: danaketh@jabbim.czb> 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.