0

I am trying to return information from my database, but all I get is an empty array when I know the database table is not empty.

This is my code

$pdo_dbconn = new PDO("pgsql:host=localhost;dbname=null;user=null;password=null")
    or die ("Could not connect");

$sql = $pdo_dbconn->prepare("SELECT * FROM prsnl_codes;");
$sql->execute();
$array = $sql->fetchALL();

var_dump($array);

This is what the response is

array(0) {}

Can anyone tell me what is going on?

rancper
  • 35
  • 6

1 Answers1

0

I solved the issue, and all the code up there was correct. The problem I was having was permission on the database, which I resolved.

rancper
  • 35
  • 6