getting integer result from 4.1 - Mailing list pgsql-php

From Mark Nelson
Subject getting integer result from 4.1
Date
Msg-id 01KPPJMDTOPE90PUDH@cc.usu.edu
Whole thread Raw
Responses Re: getting integer result from 4.1
Re: getting integer result from 4.1
List pgsql-php
Hi,

I have an update statement that queries a db and updates wheere
it finds matches. I know that postgres itself returns the number
of rows it updates because when I run the query in psql, I get
UPDATE 1, or whatever the num of rows it updates.

My question is how do I get that result with PHP? I have tried
this
        $update = //this is where I execute the query
    $updates = pg_fetch_row($update, 0);
    echo "rows updated=".$updates[0]."<br>";

But that blows up with
Warning: Unable to jump to row 0 on PostgreSQL result index 6 in
my php doc.

Same thing with pg_fetch_array. I know there is a result, because
if I check it as a boolean (ex.  if ($update) ) it always comes
back true, even when 0 rows are updated (UPDATE 0). I imagine
this is where pg_affected_rows in PHP 4.2 works well, but I am
using 4.1.2, so that isn't an option.

thanks for your time,
/mark


pgsql-php by date:

Previous
From: "Phil Geer"
Date:
Subject: Re: Error while compiling 7.3
Next
From: brew@theMode.com
Date:
Subject: Re: getting integer result from 4.1