RE: [PHP-DB] Postgres/MySQL prob's

From: Date: Mon, 03 Jul 2000 14:46:42 +0000
Subject: RE: [PHP-DB] Postgres/MySQL prob's
Groups: php.db 
Request: Send a blank email to php-db+get-833@lists.php.net to get a copy of this message
If you place an @ in front of your functions (@mysql_fetch_array($result)) it will suppress the warning messages. Wesley Choate > -----Original Message----- > From: Phil Lambert [SMTP:plambert@ossgroupltd.com] > Sent: Monday, July 03, 2000 9:48 AM > To: PHP-Database Mailing List > Subject: [PHP-DB] Postgres/MySQL prob's > > 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.db (#833) next »