Combining results that are the same
Posted: Thu Jun 16, 2005 11:08 am
I have code that accesses a database and gets results based on the a number. Part of the result is a description of features. Right now I have it set up to display each row seperately, but it looks messy if I have ten results with the same type of feature. I want to be able to have it combine all "description"s that have the same "kind" and seperate them by a comma and then move on to the next "kind"... excuse me if I am a little unclear but here is the code
Code: Select all
foreach($frows as $frowix => $frow) {
echo "<tr>\n";
foreach($frow as $fix => $f) {
$kind = $f["kind"];
$description = $f["description"];
echo "<td><font face=\"verdana\" size=\"1\"><b>$kind:</b> $description</font></td>\n";
}
echo "</tr>\n";
}