getting integer result from 4.1

From: Mark Nelson <MCN(at)cc(dot)usu(dot)edu>
To: PGSQL-PHP(at)POSTGRESQL(dot)ORG
Subject: getting integer result from 4.1
Date: 2002-12-06 18:06:56
Message-ID: 01KPPJMDTOPE90PUDH@cc.usu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-php by date

  From Date Subject
Next Message brew 2002-12-06 18:46:04 Re: getting integer result from 4.1
Previous Message Phil Geer 2002-12-06 02:19:25 Re: Error while compiling 7.3