How to extract data using postgresql?

wxdqz

New Member
I am trying to retrieve a user's email address from a postgresql database. After I run the following query, how do I extract the email address and save it as a variable? I thought that $result will give me the email address, but instead when I echo it I get a
Resource id #2

I'm new to programming so forgive me if there is an obvious answer to this.


$db=pg_connect("dbname=test user=test password=test");

$query="select email from users where username ~*'$username'and password='$password'";

$result=pg_exec($db,$query);
 
Back
Top