Re: Postgres/MySQL prob's

From: Date: Tue, 04 Jul 2000 03:50:23 +0000
Subject: Re: Postgres/MySQL prob's
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-4670@lists.php.net to get a copy of this message
instead writting: if ($myrow = pg_fetch_array($result, 0)) . . . . . try this: if ($myrow = @pg_fetch_array($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@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#4670) next »