DB interface problem
| From: | Giff Hammar | Date: | Tue, 27 Oct 2009 12:48:53 +0000 |
| Subject: | DB interface problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-46587@lists.php.net to get a copy of this message | ||
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: pg_num_rows(): supplied argument is not a valid PostgreSQL
result resource in /var/www/lib/dbi_pgsql.php on line 202
I don't know what to check next to figure out why this is happening.
Here is what I have done so far:
- Updated the old PHP commands in the dbi file to reflect new ones
var -> public
pg_numrows -> pg_num_rows
pg_cmdtuples -> pg_affected_rows
pg_exec -> pg_execute
- Connected to the database as the same user by using straight PHP calls
vs the DBI. It worked fine.
- Connected to the database via psql and that worked fine, too.
There is something with the DBI class that is not right, but I am a
novice with objects and classes, so I can't pin it down. The whole file
is here: http://www.sv-phoenix.com/dbi_pgsql.php -
it's 205 lines so I
didn't want to put the whole thing in this post.
If anyone can take a look at it and let me know what to check next, I
would really appreciate it.
Giff