Problem with either a query or IF Statement
Posted: Mon Jun 02, 2008 7:47 am
Can someone show me how I would write the IF Statement for:
I want the script to be able to go to the DB and see what access level is set.
1 should go to guest
2 should go to members
I'm not sure if it's my query at fault or the IF statement but every time it seems to be going to guest even if I have a "2" in my access row on the DB.
Please help.
$sql = 'SELECT * FROM `login`';
$result = mysql_query($sql);
if ($result ['access'] > 1) {
echo ("members only");
} else {
echo ("guest only");
}
I want the script to be able to go to the DB and see what access level is set.
1 should go to guest
2 should go to members
I'm not sure if it's my query at fault or the IF statement but every time it seems to be going to guest even if I have a "2" in my access row on the DB.
Please help.
$sql = 'SELECT * FROM `login`';
$result = mysql_query($sql);
if ($result ['access'] > 1) {
echo ("members only");
} else {
echo ("guest only");
}