php-db | 2000121
Date: 12/03/00
- Next message: jeff marston: "[PHP-DB] MySQL access via C/C++"
- Previous message: phobo: "Re: [PHP-DB] DBF to Postgres"
- In reply to: Dave Fudge: "RE: [PHP-DB] oracle8"
- Next in thread: Doug Semig: "Re: [PHP-DB] a more eloquent PostgreSQL/PHP version of MySQL/PHP routine"
- Reply: Doug Semig: "Re: [PHP-DB] a more eloquent PostgreSQL/PHP version of MySQL/PHP routine"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
# the following has worked well with MySQL.
# assume $database contains previously designated connection.
$query = "select * from something";
$result = mysql_query($query);
if ($row = mysql_fetch_array($result)) {
do {
# do whatever with your row
} while ($row = mysql_fetch_array($result));
}
# using the same syntax causes a number of errors with PostgreSQL.
# have had to resort to the following.
# assume $database contains previously designated connection.
$query = "select * from something";
$result = pg_exec($database,$query);
if(pg_numrows($result)>0) {
$tbNumRows=pg_numrows($result);
$tbCount=0;
while($tbCount<$tbNumRows) {
$row = pg_fetch_array($result,$tbCount); # or could use fetch row
# do whatever with your row/result
$tbCount++;
}
}
# would appreciate any insight into streamlining the PostgreSQL code a
little more
-- 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>
- Next message: jeff marston: "[PHP-DB] MySQL access via C/C++"
- Previous message: phobo: "Re: [PHP-DB] DBF to Postgres"
- In reply to: Dave Fudge: "RE: [PHP-DB] oracle8"
- Next in thread: Doug Semig: "Re: [PHP-DB] a more eloquent PostgreSQL/PHP version of MySQL/PHP routine"
- Reply: Doug Semig: "Re: [PHP-DB] a more eloquent PostgreSQL/PHP version of MySQL/PHP routine"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

