I'm able to display id and tags in the foreach loop no problem. But I'm having trouble showing title and height. I'm not sure how to call them into the foreach loop.
I can call them in the while loop so I know that they are working.
$persons = array();
$tags = array();
while( ($row = mysqli_fetch_array( $rs, MYSQLI_ASSOC)))
{
if(!isset( $persons[$row['id']]))
{
$persons[$row['id']]['title'] = $row['title'];
$persons[$row['id']]['height'] = $row['height'];
$persons[ $row['id'] ] = array( 'id' => $row['id'], 'tag' => $row['tag']);
$tags[ $row['id'] ] = array();
}
$tags[ $row['id'] ][] = $row['tag'];
}
foreach( $persons as $pid => $p)
{
echo 'id: # ' . $p['id'] ;
echo 'title: ' . $p['title'];
echo 'height: ' . $p['height'];
echo '<a href="#">' . implode( '</a>, <a href="#">', $tags[ $p['id'] ]) . '</a>';
echo '<br /><br />';
}