Hi,
I'm trying to just grab a small column of data from a Database and return it.
This is a function called getAccessLevel(), it returns the Access level which is an integer.
There is a table called users in the DB and the column access holds either 0, 1, or 2 to determine what users access level is. I'm trying to get the access level of a user that has the matching ID.
This is what I have thus far (**** to cover certain privacy things):
include("functions/global_functions.php");
$link = connectDatabase();
$mydb = mysql_select_db($dbname)or die("Can't select");
$userID = getID();
$query = "SELECT * FROM $tbl_name WHERE 'id'='$userID'";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
return $row['access'];
My function methods have worked in other pages, but I just haven't done that query or row fetch to isolate a single row before...I don't understand why this doesn't work.
Any help would be terrific, if you need more explanation just let me know! Thanks.