rhale Posted November 3, 2009 Share Posted November 3, 2009 what i am trying to do is just get a value from sql and then put it into a variable, it prints out the right value but when i try to use it in the if statement below it just doesnt work and i get no error or anything $accesslevels = mysql_query("SELECT accesslevel FROM $tbl_name WHERE username='$myusername' and password ='$mypassword'"); $accesslevel = mysql_fetch_assoc($accesslevels); if($accesslevel=='2'){ echo $accesslevel['accesslevel']; } Quote Link to comment https://forums.phpfreaks.com/topic/180054-solved-putting-data-from-sql-into-a-variable-then-using-it/ Share on other sites More sharing options...
Alex Posted November 3, 2009 Share Posted November 3, 2009 I think you're meaning to do: if($accesslevel['accesslevel']=='2') Quote Link to comment https://forums.phpfreaks.com/topic/180054-solved-putting-data-from-sql-into-a-variable-then-using-it/#findComment-949891 Share on other sites More sharing options...
rhale Posted November 3, 2009 Author Share Posted November 3, 2009 tyvm that worked i am very new to php and sql and am still just learning if that seemed like a real easy mistake Quote Link to comment https://forums.phpfreaks.com/topic/180054-solved-putting-data-from-sql-into-a-variable-then-using-it/#findComment-949893 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.