Code:
<?php if(($row_DetailRS1['photo2'] != NULL) && ($row_DetailRS1['photo2'] != "")) { ?>
<a href="<?php echo $row_DetailRS1['photo2']; ?>" rel="enlargeimage::click" rev="loadarea"><img src="<?php echo $row_DetailRS1['photo2']; ?>" width="100" height="100" border="0" /></a>
<?php } else { echo " "; } ?>
Now the only potential problem I see is if you have more than one division with the id of loadarea, it's unclear from your posts, but I'm assuming you do not.
In any case, if you want more help:
Please post a link to a page on your site that contains the problematic code so we can check it out.
Bookmarks