Postgres/MySQL prob's

From: Date: Mon, 03 Jul 2000 14:48:17 +0000
Subject: Postgres/MySQL prob's
Groups: php.db 
Request: Send a blank email to php-db+get-831@lists.php.net to get a copy of this message
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

« previous php.db (#831) next »