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

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

 



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@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