Re: mySQL query result from multiple tables to PHP
I am not sure if this would be considered a proper PHP/MySQL solution, but if I had to do something like that, I would probably create an multidimensional array of the data you're pulling, for example:
$userArray = array( array("user_id"=>1, "user_name"=>"Mike", "group_name"=> array("group1", "group2") ) );
as you're looping through the result set, you could check to see if the user_id is in the array (in_array), if no, create a new element, if yes, check to see if the group name exists, if not, array push the new group name into the group_name array.
you could access the group_name array by:
print_r($userArray[0][group_name]);
and a single element by:
echo $userArray[0][group_name][0];
Again, that might be a very round about way of doing it, but to put the data together the way you illustrated, that's the only solution I know of.
Hope that helps.
mike h