I started having trouble with a DBI interface to my PostgreSQL database after I built a new Ubuntu machine. The Postgres version is 8.3 and the DBI was written several years ago (by someone else). I'm using PHP version 5.2.6-3ubuntu4.2 with apache2. The problem is that I get the error: Warning:
Hi Giff, I want to have a look at this for you, but you'll need to put the file on your server as plain-text because your server is parsing the PHP code and only sending us the output, not the source code. Append *.txt to your file on the server and we should be able to see it better!
Andy, Sometimes I'm too fast for my own good. I added .txt to the file and it should be visible as http://www.sv-phoenix.com/dbi_pgsql.txt. Just appending the .txt didn't work. Thanks for taking a look! Giff On Tue, 2009-10-27 at 17:49 +, Andy Shellam (Mailing Lists) wrote: Hi Giff, I
Hi Giff, No worries - I know the feeling well! At first glance this looks OK, however I notice that there is no res property defined in the STH class, like there is session and query. $this-res on line 202 is what's causing the issue - PHP is saying it's not a valid PostgreSQL result
Andy Shellam (Mailing Lists) wrote: Hi Giff, No worries - I know the feeling well! At first glance this looks OK, however I notice that there is no res property defined in the STH class, like there is session and query. $this-res on line 202 is what's causing the issue - PHP is saying it's
Hi Chris, $this-res = @pg_execute($this-session, $query); PHP is therefore trying to assign a query result to a property that doesn't exist. I would have expected PHP to throw an error at this but it may have been obscured with your logging settings, I'm not sure. Close - the '@'
Andy, Thanks for your help! The var_dump after the pg_execute showed that the execute() method wasn't being called (I left a line out of the calling script). Once I fixed that, I changed pg_execute back to pg_exec and it worked as expected. Now I have to figure out the difference between pg_exec
Hi Giff, Glad you got it sorted! pg_exec() is the old (and deprecated) name for pg_query - this behaves differently to pg_execute. pg_execute runs a SQL statement that has previously been prepared with a call to pg_prepare, while pg_query runs a SQL query directly.