Re: Implode? Explode?
| From: | Jack Jackson | Date: | Mon, 06 Jun 2005 19:02:51 +0000 |
| Subject: | Re: Implode? Explode? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-216510@lists.php.net to get a copy of this message | ||
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!