drummer101 Posted February 22, 2008 Share Posted February 22, 2008 When echoing my array, it evaluates to, "Array" ??? $group_id = mysql_query("SELECT phpbb_user_group.group_id FROM phpbb_user_group WHERE phpbb_user_group.user_id = '".$i['user_id']."'"); $last_online = date('g:ia l, M jS Y'); $j = mysql_fetch_array($group_id); $group = array($group_id); if($password == $i['user_password']){ echo $group; if(array_key_exists("6",$group)){ echo "Works"; } else { echo "Doesn't work "; } } the sql statement evaluates to 6,19,2 Trying to figure out how to get the sql statement into a php array to case check. Quote Link to comment https://forums.phpfreaks.com/topic/92407-array-problem/ Share on other sites More sharing options...
Daniel0 Posted February 22, 2008 Share Posted February 22, 2008 You cannot echo an array like that. If you wish to represent an array as a string then use print_r(), var_dump or var_export(). Quote Link to comment https://forums.phpfreaks.com/topic/92407-array-problem/#findComment-473497 Share on other sites More sharing options...
drummer101 Posted February 22, 2008 Author Share Posted February 22, 2008 Any idea why the case check is evaluating to false? or should I be using array($j) instead of array($group_id)? Quote Link to comment https://forums.phpfreaks.com/topic/92407-array-problem/#findComment-473715 Share on other sites More sharing options...
Daniel0 Posted February 22, 2008 Share Posted February 22, 2008 Yes, you should use $j instead. Quote Link to comment https://forums.phpfreaks.com/topic/92407-array-problem/#findComment-473858 Share on other sites More sharing options...
drummer101 Posted February 24, 2008 Author Share Posted February 24, 2008 Hrmm I'm having a problem getting the SQL statement into the php array. Only the last column, 6 will echo when I check it. How can I store all three results in an array? Quote Link to comment https://forums.phpfreaks.com/topic/92407-array-problem/#findComment-474989 Share on other sites More sharing options...
Daniel0 Posted February 24, 2008 Share Posted February 24, 2008 Loop through it. There are some examples here: http://php.net/mysql Quote Link to comment https://forums.phpfreaks.com/topic/92407-array-problem/#findComment-474991 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.