Re: postgresql csv import pdo

[email protected] (Ashley Sheridan)
Newsgroups php.general
Message-ID <[email protected]>
On 14/09/2021 22:50, ourdiaspora wrote:
> 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?
Indeed, what is the error? Is there anything shown in the logs at all? 
What output do you get?

-- 
Ashley Sheridan
https://www.ashleysheridan.co.uk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.