From: Mark Nelson <MCN@cc.usu.edu>
To: PGSQL-PHP@POSTGRESQL.ORG
Subject: getting integer result from 4.1
Date: Fri, 06 Dec 2002 11:06:56 -0700 (MST)
Message-ID: <01KPPJMDTOPE90PUDH@cc.usu.edu> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: MCN@cc.usu.edu
Subject: Re: getting integer result from 4.1
In-Reply-To: <01KPPJMDTOPE90PUDH@cc.usu.edu>
References: <01KPPJMDTOPE90PUDH@cc.usu.edu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox