Hi,
I'm hoping this is something quite basic. I'm trying to group values from a MySQL query into an array. I have a Wordpress set-up but I'm presuming this is more of a PHP rather than a Wordpress concern. I just want to know basically what is the best way of doing this. Essentially I currently have the following data:

Artist Name #1 - Event Date #1
Artist Name #2 - Event Date #2
Artist Name #1 - Event Date #3
Artist Name #1 - Event Date #4

And I want to find a way that I can group the Artist Names so that the data would output like this:

Artist Name #1
Event Date #1
Event Date #3
Event Date #4

Artist Name #2
Event Date #2

This is the code I have at the moment. How would I integrate an array and an extra Foreach loop to get the data organised like this. I'm still learning Arrays at the moment and would appreciate any assistance with this.

PHP Code:
        global $post;        
        
$args = array( 'post_type' => 'event''orderby' => 'meta_value''meta_key' => 'event_date''meta_compare' => '>''meta_value' => $todaysDate'numberposts' => 6'order' => 'ASC' );
        
$whatson get_posts$args );
        
$count 1;
        foreach( 
$whatson as $post ) :
            echo 
get_the_title(get_post_meta($post->ID'2artist'true)) . " - ";
            echo 
get_post_meta($whatson_query->ID'event_date'true);
        endforeach; 
Thanks!
Russ