title: How can I resolve the "Resource ID #8" error message in PostgreSQL/PHP?
body: <p><strong>How can you solve the <em><a href="http://www.bigresource.com/PHP-Resource-id-8-CzaOmKEZ.html#" rel="nofollow noreferrer">Resource ID #8</a></em> -error message in the following code?</strong></p>
  
  <p>The error apparently means that I have a bug in my SQL statement.
  However, I cannot see it.</p>
  
  <pre><code> $result = pg_prepare($dbconn, "query1", "SELECT user_id FROM users 
       WHERE email = $1;");
   $result = pg_execute($dbconn, "query1", array("test@gmail.com"));
   // to read the value
  
   while ($row = pg_fetch_row($result)) {
       $user_id = $row[0];
   }
  </code></pre>
  
  <p>I get the error message when I try to <code>echo $result</code>.</p>