[thelist] RE: SQLSession to PostgreSQL

Treasurer, OTO Australia treasurer at otoaustralia.org.au
Fri Mar 15 23:42:01 CST 2002


Hi Andrew,

Thanks for your help. I'm still confused though.

The variable $this->queryresult = pg_exec($db_conn, $query)
which is:

$query = SELECT * FROM oto_sessions WHERE session_id='0pmymn7zXZ8ldBE8SHmA'

If I print($this->queryresult); I get "Resource id #2" which to my
knowledge is the correct output, although I am definitely NOT an
expert!

There are 5 fields in the DB and the first 4 are filled with
session_id, session_ip, session_datetime, session_lastaction,
session_userid(which is NULL).

The query is correct and should return a value, but even if it is NULL
does anyone know how I can stop the error message or get it the
function to return a NULL value?

Warning: Unable to jump to row 0 on PostgreSQL result index 2 in
db.class.php on line 109

On Sat, 2002-03-16 at 17:33, Andrew Forsberg wrote:
>> 109        while ($row = pg_fetch_array($this->queryresult,0))
>
>Doh! Sorry, jumped the gun, the show stopper might be the 0 rather than
>$c in the loop (didn't notice it, as I've not worked with postgresql,
>and didn't realize they require a row counter for their array fetching
>routine):
>
>> 109     while ($row = pg_fetch_array($this->queryresult, $c)) {
>
>But I can't see why 0 wouldn't work at all. Perhaps it's getting caught
>in an infinite loop? Always processing the same row (i.e. row 0)?

There is DEFINITELY some horrible Infinite Loop there somewhere. If I
do the following:

>> 109     while ($row = @pg_fetch_array($this->queryresult, $c)) {

to avoid the error message it gets stuck in a loop until it times out.

Cheers,
Andrew McKiernan
http://www.kephra.com.au
http://www.otoaustralia.org.au




More information about the thelist mailing list