Problem scenario
In a LAPP stack deployment, a PHP variable is displaying a value "Resource id #2" or "Resource id #3." You are expecting a different value. The PHP variable having the problem is the result of a SQL command ran against a PostgreSQL database. What should you do?
Solution
Assuming that $var1 is displaying the undesirable "Resource id #2" or "Resource id #3", do something like this:
$var1 = pg_query($query);
$rowa = pg_fetch_row($var1);
$rowb = current($rowa);
Now use $rowb in the capacity you were trying to use $var1. It should display a human readable value.