LES DOCS C EST FAIT PR ETRE LUES
Code :
- <?php
- $conn = pg_pconnect ("dbname=publisher" );
- if (!$conn) {
- echo "An error occured.\n";
- exit;
- }
- $result = pg_query ($conn, "SELECT * FROM authors" );
- if (!$result) {
- echo "An error occured.\n";
- exit;
- }
- $num = pg_num_rows($result);
- for ($i=0; $i < $num; $i++) {
- $r = pg_fetch_row($result, $i);
- for ($j=0; $j < count($r); $j++) {
- echo "$r[$j] ";
- }
- echo "<BR>";
- }
- ?>
|
Note: From 4.1.0, row became optional. Calling pg_fetch_row() will increment internal row counter by 1.