mysql_query() return "Resource id #2" not value fr

A

Anonymous

Guest
Here is my code:

Code:
include("database.php");

global $conn;

$q = "select access from users where username = '$username' and PASSWORD = '$password'";
$result = mysql_query($q,$conn);
echo $result

$conn holds the connection string.

This query returns the correct value when run natively from phpMyAdmin.

But keeps returning "Resource id #2" when running through php.

Can anyone point me in the right direction to solving this issue as I have spent quite a bit of time trying to sort it out and there is no particular information on the php.net site.

Cheers
 
You need to use a mysql function to extract the data out of the resultset, the Result resource #2 is only a reference to the results.

Code:
  mysql_result($result)
  mysql_fetch_array($result)

http://za2.php.net/manual/en/ref.mysql.php
 
Back
Top