getting integer result from 4.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux