getting integer result from 4.1

Поиск
Список
Период
Сортировка
От Mark Nelson
Тема getting integer result from 4.1
Дата
Msg-id 01KPPJMDTOPE90PUDH@cc.usu.edu
обсуждение исходный текст
Ответы Re: getting integer result from 4.1  (brew@theMode.com)
Re: getting integer result from 4.1  (brew@theMode.com)
Список 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 по дате отправления:

Предыдущее
От: "Phil Geer"
Дата:
Сообщение: Re: Error while compiling 7.3
Следующее
От: brew@theMode.com
Дата:
Сообщение: Re: getting integer result from 4.1