PHP and PostgreSQL - Mailing list pgsql-general

From Uro Gruber
Subject PHP and PostgreSQL
Date
Msg-id 631076786.20010105231729@sir-mag.com
Whole thread Raw
Responses Re: PHP and PostgreSQL
Re: PHP and PostgreSQL
Re: PHP and PostgreSQL
List pgsql-general
Hi!

I have some questions about coding in php with postgre.

Here is my code

$qu = pg_exec ($db_conn, "SELECT * FROM clients ORDER BY username");
$row = 0; // postgres needs a row counter other dbs might not
while ($data = @pg_fetch_object ($qu, $row)) {
echo $data->username." (";
echo $data->password ."): ";
echo $data->client_id."<BR>";
$row++;
}

When i execute this i get 3 records (in DB is also 3 records), if i
delete @ before pg_fetch_object i get an error:

"Unable to jump to row 3 on PostgreSQL result index 4"

I understand what's wrong and i know why is that @.

What i do want to know is, if there is something wrong with this
function or am i doing something wrong. I don't like that kind of
errors. How can i stop before the end.

In mysql there was no need to count rows.

Thanks
--
Uros



pgsql-general by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: mysql data to pgsql
Next
From: Tom Lane
Date:
Subject: Re: SHM ids (was running pgsql 7 under Jail'ed virtual machine on FreeBSD 4.2)