|
<%
// counter of rows being displayed
$photoIndexRowCounter = 0;
// keep track of which column we are currently working on (two-column layout)
$photoIndexColumn = 1;
// keep track of the musician whose pic are currently shown
$currentMusician = "";
// put 1/2 of the entries into a first cell of the table (creates two-column layout)
$nbrIndexEntries = mysql_num_rows($photoIndexResults);
while ($photoIndexRow = mysql_fetch_array($photoIndexResults)){
$photoIndexRowCounter ++;
if ($currentMusician != $photoIndexRow['FNAME']." ".$photoIndexRow['LNAME']){
// first row in the query results for a new musician
// remember the new musicion
$currentMusician = $photoIndexRow['FNAME']." ".$photoIndexRow['LNAME'];
// test if we should start the second column for the overall layout,
// as we have shown at least 1/2 of the entries
if (($photoIndexColumn == 1) && ($photoIndexRowCounter > ($nbrIndexEntries/2))){
echo " | "; // start second column
$photoIndexColumn = 2; // remember that we started 2nd column
}
// print out musician name
echo "";
echo "";
echo "";
}
echo " ";
echo " ";
if ($photoIndexRow['PICDATE'] != "1900-12-31"){
echo "".date("M j Y",strtotime($photoIndexRow['PICDATE']))."";
echo " — ";
}
echo "".$photoIndexRow['PICTITLE']."";
echo "";
}%>
|