postgresql csv import pdo
| From: | ourdiaspora | Date: | Tue, 14 Sep 2021 21:50:09 +0000 |
| Subject: | postgresql csv import pdo | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-327687@lists.php.net to get a copy of this message | ||
Readers,
Forgive the simplicity, but having problems to start:
<?php
try {
$dbconnect = new PDO(pgsql:host=localhost; dbname=cpacweb; user=someuser; password=somepassword);
}
catch(PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
$query = "SELECT * FROM somedata";
$result = pg_exec($dbconnect, $query);
echo "Number of rows: " . pg_numrows($result);
pg_freeresult($result);
pg_close($dbconnect);
?>
No error message, no print of rows of table. Please what is the error?