This may help you on your way. The only issue is that the example table output is rather different from what your original code was doing?? Let me know if this helps you out at all, or how it needs to be tweaked, or if you want bits explained etc etc. (or if it doesn’t work! not tested locally - i’m daring like that)
[php]
$sql = “SELECT
id
,store
,1L
,1R
,2L
,2R
FROM
flavors
ORDER BY
id
ASC”;
$results = mysql_query($sql);
$stores = array();
while(false !== ($row = mysql_fetch_assoc($results)))
{
$id = $row[‘id’];
$store = $row[‘store’];
if(!in_array$store,$stores)) $stores[$store] = array();
$stores[$store][$id] = $row;
}
foreach($stores as $store => $data)
{
echo ‘
Store: "’.$store.’"
’;
echo ‘
’;
foreach($data as $id => $info)
{
echo ‘’;
echo ‘![]() | ’;
echo ‘1 | ’;
echo ‘![]() | ’;
echo ‘
’;
echo '<tr>';
echo '<td><img src="'.$info['2L'].'.jpg" /></td>';
echo '<td>2</td>';
echo '<td><img src="'.$info['2R'].'.jpg" /></td>';
echo '</tr>';
}
echo '</tbody></table>';
}
[/php]