Forum Moderators: coopster
'alumInfo enum ('0','1') NOT NULL default='0',
I query it like this:
$sql = mysql_query
("SELECT alumInfo FROM users WHERE username='$username' AND password='$password'");
Then I want to check what the value is. If it's 0 I want to print one thing, if it's 1 I want to print something else. I've tried something like this:
$row = mysql_fetch_array($sql); // I'm thinking the problem lies here...
if($row['alumInfo'] == '0') {
echo "one thing";
} else {
echo "something else";
}
It seems to ignore the first 'echo' and only prints the last one, even though the default value is '0'.
Any suggestions? Thanks.
you could also try echoing the value of the variable to see what is in there
$row = mysql_fetch_array($sql);
echo '<p>alumInfo is: ',$row['alumInfo'],'<p>';
if($row['alumInfo'] == '0') {
echo "one thing";
} else {
echo "something else";
}
you could also try echoing the value of the variable to see what is in there
First see what the query is return before you do any comparison. You might not be getting anything. Just do a simple echo of $row['alumInfo'] to see what it returns, or log into your mysql and test it manually. If you find out that it is returning an empty set, then you have a problem with your query because obviously the values aren't in the table.