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

From: Date: Tue, 26 May 2009 19:41:35 +0000
Subject: Re: pg_prepare()/pg_execute() and pg_query_params()
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-46203@lists.php.net to get a copy of this message
Can you provide us with some of the queries you send to database? I'd suggest you test it with some easy and simple one, like this on from PHP documentation: |$result = pg_query_params($dbconn, 'SELECT * FROM shops WHERE name = $1', array("Joe's Widgets")); | Brandon Metcalf napsal(a):
I'm fairly new to PHP but have a great deal of Perl experience for what it's worth. I'm having a problem where if I try to use a parameterized query it fails but pg_last_error() returns nothing. For example, $result = pg_query_params($pgconn, $update, array($foo, $bar)); if (! $result) {
      fwrite($fp, "before");
      fwrite($fp, pg_last_error());
      fwrite($fp, "after");
} The strings "before" and "after" are showing up in $fp, but nothing from pg_last_error(). Similarly, if I use pg_prepare() and pg_execute(), pg_prepare() fails but nothing is returned from pg_last_error(). Using pg_query() works, but I need to parameterize the SQL. The versions I'm using are $ php --version PHP 5.2.4-2ubuntu5.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Feb 11 2009 20:09:52) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies and PostgreSQL 8.3.6. What am I missing?
-- S pozdravem Daniel Tlach Freelance webdeveloper Email: mail@danaketh.com ICQ: 160914875 MSN: danaketh@hotmail.com Jabber: danaketh@jabbim.cz

« previous php.db (#46203) next »