I'm trying to display a table of images, organized horizontally by category and vertically by date. Some dates may have more than one image, but most will only have one.
This is the code I've come up with, and was confident would work, but doesn't:
# write it all out
echo'<p>The "current" file is outlined in <span style="color:red;">red</span>. "Future" files are outlined in <span style="color:#00f;">blue</span>. All the others are archived.</p>'."\r\n";
echo'<table style="width:2000px;">';
## iterate through FileIDs
foreach($FileName as $nkey=>$nval){
echo'<tr><td style="border-top:1px dotted #222;clear:both;"><h3>'.$nval.'</h3></td>'."\r\n";
$ct=0;
foreach($fileinfo as $fa=>$fb){
$style='';
$q=intval($fb['FilesRelevance']); // nn to n
if ($q!==$nkey){continue;}
// ^^ if the data we're looking at isn't for this FilesRelevance, move on
// otherwise...
$ct++;
$fm=$fb['FilesMonth'];
$fy=$fb['FilesYear'];
$fn=$fb['FilesName']; //sltdsxxxxxx
$fc=$fb['Current'];
if($fc=='1'){$style='style="border: 1px solid #f00;" ';}
$ff=$fb['Future'];
if($ff=='1'){$style='style="border: 1px solid #00f;" ';}
$mo=date("F", mktime(0, 0, 0, ($fm))); //should return full month name of previous month (m=MM, F=Month)
echo'<td class="stuff">';
echo' '.' '.$nval.' '.$mo.', 20'.$fy.'<br>'."\r\n";
## adding for multiple images per month
$fileloc=$fn;
include('/home/myurl/www/www/folder/jpegsDirectory.php'); // jpegsDirectory finds all that have $fileloc in name, returns $files[] array
//print_r($files);
foreach($files as $fival){
$floc='http://myurl.com/folder/'.$fival;
echo' <img src="'.$floc.'" height="250px" width="250px" '.$style.'alt="'.$nval.'" /></td> '."\r\n";
}
}
//if($ct==0){echo' NONE.'."\r\n";}
echo'</tr>';
}
echo'</table>';
This will display the informational paragraph, then the table with each row and column.
But what happens is, the first row has a column with multiple images... and that group of images displays BEFORE the table, after the informational paragraph.
I can't figure out how that happens.
Any help would be appreciated.