Re: [PHP] joining array values

2005-05-12 Thread Brent Baisley
You're losing me hear without sample data, but I'll try. Ideally your input array would be something like: $result[] = array('id'=>23, 'text'=>'ok', 'relevance'=>2); $result[] = array('id'=>42, 'text'=>'joel', 'relevance'=>1); $result[] = array('id'=>23, 'text'=>'php', 'relevance'=>1); Which gives

Re: [PHP] joining array values

2005-05-12 Thread Jochem Maas
Merlin wrote: Brent Baisley wrote: Use the id number as the array key and a simple loop should join everything together. for($i=0; $i $id = $result['id'][$i]; $text = $result['text'][$i]; $relevance = $result['relevance'][$i]; $resultSummary[$id]['id'] = $id; if ( isset($re

Re: [PHP] joining array values

2005-05-12 Thread Merlin
Brent Baisley wrote: Use the id number as the array key and a simple loop should join everything together. for($i=0; $i $id = $result['id'][$i]; $text = $result['text'][$i]; $relevance = $result['relevance'][$i]; $resultSummary[$id]['id'] = $id; if ( isset($resultSummary[$

Re: [PHP] joining array values

2005-05-12 Thread Brent Baisley
Use the id number as the array key and a simple loop should join everything together. for($i=0; $i $id = $result['id'][$i]; $text = $result['text'][$i]; $relevance = $result['relevance'][$i]; $resultSummary[$id]['id'] = $id; if ( isset($resultSummary[$id]['text']) ) { $resultSummary[$id][

[PHP] joining array values

2005-05-12 Thread Merlin
Hi there, I do have a tricky problem with arrays. There are 3 arrays: $result[id][] $result[text][] $result[relevance][] Now there might be the case that there are more results with the same $id. I would like to count all the relevances together for the same id. For example: id textrelev