I have a database script that is supposed to access a MySQL table and return a (1 | 0) value. Instead of getting data, I'm getting the Resource ID number of the column. Here's what I have:
<?php
function checkid($id,$directory)
{
$connection = mysql_connect("myserver.webaddress.com","user_id","access_pw")
or die ("Could not connect to database server");
$db = mysql_select_db("security",$connection)
or die ("Could not connect to database");
$query = "select $directory from directories where access_id='$id' ";
$result = mysql_query($query)
or die ("Query had errors");
mysql_close($connection);
return $result;
}
$value = checkid(user1,dir_name);
echo $value;
?>
When I look at the result on the screen, instead of seeing a 1 or a 0, I see "Resource id #3".
Do I need to feed my results into an array and read it from there, or is there a simple fix to my code? Any assistance would be appreciated...
John K