i think the issue is in using the cookie.
your link to the detail page aleady passes the user id as the CustID querystring variable
PublicPhotosProfilePages/PublicPhotosProfilePage.php?CustID=<?php echo(rawurlencode($row_WADAimagetable['CustID'])); ?>
just use that querystring variable for filtering the recordsets.