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. 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. Link to comment https://forums.phpfreaks.com/topic/206594-mysql-selecting-multiple-columns/#findComment-1080567 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.