nikee
02-07-2010, 12:53 PM
Hey. :)
I'm trying to get the value of the "admin" field in a table called "users". I can't see what's gone wrong, but something clearly isn't right. :eek:
mysql_connect("$connect_host", "$connect_username", "$connect_password") or die("Ooops! Det gick inte att ansluta till servern.<br />" . mysql_error());
mysql_select_db("$connect_db_name") or die("Det gick inte att välja databas :(" . mysql_error());
$checkUserAdmin = mysql_query("SELECT admin FROM users WHERE username='" . $_SESSION['username'] . "'");
echo $checkUserAdmin;When i echo it out, all i get is "Resource id #8", when i'm expecting a "0" or "1". The admin field is an int, if that matters..?
Thanks in advance :rolleyes:
EDIT: I forgot to mention that $_SESSION['username'] is the username of the currently logged in user. If i echo that out, i get the right username so i'm sure that's not the problem. :)
I'm trying to get the value of the "admin" field in a table called "users". I can't see what's gone wrong, but something clearly isn't right. :eek:
mysql_connect("$connect_host", "$connect_username", "$connect_password") or die("Ooops! Det gick inte att ansluta till servern.<br />" . mysql_error());
mysql_select_db("$connect_db_name") or die("Det gick inte att välja databas :(" . mysql_error());
$checkUserAdmin = mysql_query("SELECT admin FROM users WHERE username='" . $_SESSION['username'] . "'");
echo $checkUserAdmin;When i echo it out, all i get is "Resource id #8", when i'm expecting a "0" or "1". The admin field is an int, if that matters..?
Thanks in advance :rolleyes:
EDIT: I forgot to mention that $_SESSION['username'] is the username of the currently logged in user. If i echo that out, i get the right username so i'm sure that's not the problem. :)