Hi,
Sorry, my brain is dead

. What I'm trying to do is output an array of info for a gallery like page. Below is the function - I've stripped it down to be bare bones.
Based on the # of records, rows and columns passed, the appropriate rows and columns should be displayed. But I running into a wall.
For example, if there are 13 records and rows is 3 and columns is 5. Then there should be 3 row of results - the last row having only 3 records.
Any help would be really appreciated. Thanks
ffunction setupGallery( $EntryList = NULL, $numberOfRows, $columnsPerRow )
{
$totalRecords = count($EntryList);
$tilesPerPage = $numberOfRows * $columnsPerRow;
if ( $totalRecords < $tilesPerPage )
{
$numberOfRows = floor( $columnsPerRow - ( $totalRecords / $columnsPerRow ) );
$numberOfColums = floor( $columnsPerRow - ( $totalRecords / $columnsPerRow ) );
$isLessThan = TRUE;
}
if ( $totalRecords <= $columnsPerRow )
{
$numberOfRows = 1;
$columnsPerRow = $totalRecords;
}
$lastColumnNumber = 0;
$html_text = '<table id="MyTable" border="0">';
// total records from db
for ( $row=0; $row < $totalRecords; $row++ )
{
// This is screwed
if ( $row >= $columnsPerRow )
{
$lastColumnNumber = (int) @floor( $row / $columnsPerRow );
} else {
$lastColumnNumber++;
}
if ( $lastColumnNumber == $columnsPerRow )
{
$html_text .= '<tr>';
}
$html_text .= '<td><table><tr>';
$html_text .= '<td><div">';
$html_text .= $EntryList[$row][0] . '</div></td>';
$html_text .= '<td valign="top" align="left">';
$html_text .= '<div>';
$html_text .= '<span>' . $EntryList[$row][1] . '</span><br />';
$html_text .= '<span>' . strtoupper( $EntryList[$row][2] ). '</span>';
$html_text .= '</div>';
$html_text .= '</td></tr></table></td>';
if ( $lastColumnNumber == $columnsPerRow )
{
$html_text .= '</tr>';
}
} // end for
$html_text .= '</table>';
return $html_text;