freshrod Posted May 5, 2006 Share Posted May 5, 2006 I posted this before in nOOb, but really didn't get it figured out. It's really puzzling me.Basically I have a value in a DB field that I want to check. The column is set up like this:'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.I know there is data in the field from looking with my MySQL Command Line, but: echo '<p>alumInfo is: ',$row['alumInfo'],'<p>'; gave me no result. So possible I'm doing the query wrong? Or is it the mysql_fetch_array? Thanks. Link to comment https://forums.phpfreaks.com/topic/9130-getting-data-from-a-db-query/ Share on other sites More sharing options...
ober Posted May 5, 2006 Share Posted May 5, 2006 Hmm... double posting. Yeah, that's against forum guidelines. If you want it moved to this board, that can be done, but please don't double post. You can bump your old thread if it hasn't been answered or PM me to have it moved to here.Thread Closed. Link to comment https://forums.phpfreaks.com/topic/9130-getting-data-from-a-db-query/#findComment-33563 Share on other sites More sharing options...
Recommended Posts