Re: [PHP-DB] DB interface problem

2009-10-28 Thread Samuel ROZE
Why not using PDO ? It is a global and standardized method to access to data. :-) 2009/10/27 Giff Hammar gham...@sv-phoenix.com: 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

Re: [PHP-DB] DB interface problem

2009-10-28 Thread Giff Hammar
Thanks for the suggestion. I'll need to look into it. Giff On Wed, 2009-10-28 at 11:23 +0100, Samuel ROZE wrote: Why not using PDO ? It is a global and standardized method to access to data. :-) 2009/10/27 Giff Hammar gham...@sv-phoenix.com: I started having trouble with a DBI interface

[PHP-DB] DB interface problem

2009-10-27 Thread Giff Hammar
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:

Re: [PHP-DB] DB interface problem

2009-10-27 Thread Andy Shellam (Mailing Lists)
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!

Re: [PHP-DB] DB interface problem

2009-10-27 Thread Giff Hammar
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

Re: [PHP-DB] DB interface problem

2009-10-27 Thread Andy Shellam (Mailing Lists)
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

Re: [PHP-DB] DB interface problem

2009-10-27 Thread Chris
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

Re: [PHP-DB] DB interface problem

2009-10-27 Thread Andy Shellam (Mailing Lists)
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 '@'

Re: [PHP-DB] DB interface problem

2009-10-27 Thread Giff Hammar
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

Re: [PHP-DB] DB interface problem

2009-10-27 Thread Andy Shellam (Mailing Lists)
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.