Обсуждение: portiny mysql to postgres, pg_fetch_array woes
I'm in the process of porting some mysql to postgres, and I'm having trouble with warnings associated with fetch_array
code is something like this
while ($URow=pg_fetch_array($Result,$i++))
{
}
which works, except if the array has no elements, or $i runs off the end of the array, then the pg_fetch_array returns
false(as desired), but also generated an unwanted error warning, eg:
-->Warning: Unable to jump to row 0 on PostgreSQL result index 5 in /home/ben/public_html/database.php on line 62
how do I prevent these warnings? Without having to test the number of rows in result.
On Thu, 8 Nov 2001, ben palmer wrote:
> code is something like this
> while ($URow=pg_fetch_array($Result,$i++))
> {
> }
[snip]
> how do I prevent these warnings? Without having to test the number of
> rows in result.
this way:
while ($URow=@pg_fetch_array($Result,$i++))
{
}
(note the @ before pg_fetch_array)
Regards
--
Helge Bahmann <bahmann@math.tu-freiberg.de> /| \__
Network admin, systems programmer /_|____\
_/\ | __)
$ ./configure \\ \|__/__|
checking whether build environment is sane... yes \\/___/ |
checking for AIX... no (we already did this) |