It looks good. Try switching this:
<?php foreach ($record['mainphoto'] as $upload): ?>
Back to this:
<?php foreach ($malesRecords['mainphoto'] as $upload): ?>
You always need to use the variable names you set at the top of the file. You can see them set here:
list(
$malesRecords, $malesMetaData) = getRecords(array(
'tableName' => 'males',
));
Let me know if that gets you any further.
Dave Edis - Senior Developer
interactivetools.com