Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A0B364769A2 for ; Fri, 6 Dec 2002 13:09:53 -0500 (EST) Received: from grumpy.usu.edu (grumpy.usu.edu [129.123.1.86]) by postgresql.org (Postfix) with ESMTP id C66B9476A42 for ; Fri, 6 Dec 2002 13:07:05 -0500 (EST) Received: from cc.usu.edu by cc.usu.edu (PMDF V5.2-32 #39089) id <01KPPJMDT07K90PUDH@cc.usu.edu> for PGSQL-PHP@POSTGRESQL.ORG; Fri, 6 Dec 2002 11:06:56 MST Date: Fri, 06 Dec 2002 11:06:56 -0700 (MST) From: Mark Nelson Subject: getting integer result from 4.1 To: PGSQL-PHP@POSTGRESQL.ORG Message-id: <01KPPJMDTOPE90PUDH@cc.usu.edu> X-VMS-To: PGSQL-PHP@POSTGRESQL.ORG MIME-version: 1.0 Content-type: TEXT/PLAIN; CHARSET=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/7 X-Sequence-Number: 1682 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]."
"; 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