php-general | 2000071

[PHP] Re: [PHP-DB] Postgres/MySQL prob's From: SaS (salmanas <email protected>)
Date: 07/03/00

instead writting:

if ($myrow = pg_fetch_array($result, 0))
. . . . .

try this:

if ($myrow =  <email protected>($result, 0))
. . . . .

Let me know if this success!
SaS

Phil Lambert wrote:

> Hi all,
> im working through a tutorial that uses PHP and MySQL that uses the
> following code to iterate through a database: -
>
> if ($myrow = mysql_fetch_array($result))
> {
> echo "<table border=1>\n";
> echo "<tr><td>Name</td><td>Position</td></tr>\n";
>
> do
> {
> printf("<tr><td>%s %s</td><td>%s</tr>\n", $myrow["first"],
> $myrow["last"], $myrow["address"]);
> }
> while ($myrow = mysql_fetch_array($result));
>
> echo "</table>\n";
> }
> else { echo "Sorry, no records were found!"; }
>
> My system is using Postgres and the equivilent xx_fetch_array function
> requires a row number: -
>
> if ($myrow = pg_fetch_array($result, 0))
> . . . . .
>
> My problem is that if the select statement returns 0 matches i get the
> following error: -
>
> Warning: Unable to jump to row 0 on PostgresSQL result index 2 in
> /home/httpd/html/intranet/phil/test5.php3 on line 21
>
> Phil Lambert
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>