Can someone please help explain why I am getting errors with Postgres query?
I have tried both variances of pg_fetch & pg_object in my query, but I continue to get a warning error:
Warning: pg_fetch_assoc() expects parameter 1 to be resource, boolean given in /opt/vhosts/body.php on line 45
Can someone help confirm that my query is correct, or if my assumption that I am getting a boolean return because I am not getting a response from the server for my specific table - therefore issue with server or db access...
I've checked DB connection, it is good and connected.
Here is my query:
<?php
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
require_once ('.db.conf.php');
$db = pg_connect($dbstr_RW);
//$login = $_SERVER['PHP_AUTH_USER'];
$result = pg_query($db, "select * from user");
?>
Here is my result array - logic is select all from user table and output city data within that table.
<?php
while($row = pg_fetch_assoc($result))
{
echo $row['city']."<br>";
}
echo "</ul></div>";
?>