Nexus10 Posted July 3, 2010 Share Posted July 3, 2010 $result = mysql_query("SELECT * FROM Users WHERE user_name = '$user_name'"); $result = mysql_fetch_row($result); $email = $result['email']; $userMoney = $result['money']; $userPoints = $result['points']; Hi, how can I get the above code to work where I can use $email = $result['email']; etc by subbing in the column name in between the square brackets? Currently $email and the other two are not receiving the values as something is wrong with my query I think. Quote Link to comment https://forums.phpfreaks.com/topic/206594-mysql-selecting-multiple-columns/ Share on other sites More sharing options...
premiso Posted July 3, 2010 Share Posted July 3, 2010 $result = mysql_fetch_assoc($result); Change the fetch_row to fetch_assoc. Row returns an index based array, assoc fetches an associative array. Quote Link to comment https://forums.phpfreaks.com/topic/206594-mysql-selecting-multiple-columns/#findComment-1080567 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.