Re: postgresql csv import pdo
[email protected] (Christophe DALOZ - DE LOS RIOS)
| Newsgroups | php.general |
|---|---|
| Message-ID | <CAPG57A98vYorzah3Qqvrk+fv=Y+fyj2TQsZQ50ucKggDmeWrVQ@mail.gmail.com> |
Hello, The entire code block can in try catch, but if the error in PDO usage, the PDOException is catching. Le mar. 14 sept. 2021 à 23:50, ourdiaspora <[email protected]> a écrit : > 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? >