Re: Implode? Explode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Brent Baisley wrote:
You're close, but you need to group your data on the series_id first. You can do that by looping through your array and creating another array using series_id as the array key. You'll end up with a list of arrays named after the series_id.

foreach( $result_set as $result_item ) {
    //Add an array item to the series_id slot of the grouped_result array
$grouped_result[ $result_item['series_id'] ][] = array('id'=>$result_items['art_id'], 'title'=>$result_item['art_title']);
}

That did the trick, Brent. Thanks so much for this useful information.

Now you have your data grouped by series_id. Each item of the grouped_result array will contain one or more arrays which contain the art_id and art_title.

If you are not familiar with multidimensional arrays, this may be a little confusing.

A little is right! But tanks for the intro to multi-dimensional arrays!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux