А можно вот ненужную верхушку убрать и оставить просто вот так:
<!--c1--><div class='codetop'>Код</div><div class='codemain'><!--ec1--><?php
$result=dbquery(
"SELECT ta.album_id,album_title,photo_id,photo_title,photo_thumb1 FROM ".$db_prefix."photo_albums ta ".
"INNER JOIN ".$db_prefix."photos USING (album_id) ORDER BY RAND() LIMIT 3");
if (dbrows($result) != 0)
{
openside("Фотогалерея");
while ($data = dbarray($result))
{ if ($data['photo_thumb1'] && file_exists(PHOTOS."album_".$data['album_id']."/".$data['photo_thumb1'])){
$rphoto = PHOTOS."album_".$data['album_id']."/".$data['photo_thumb1'];
} else {
$rphoto = IMAGES."imagenotfound.jpg";
}
echo "<div style='text-align:center'>
<a href='".BASEDIR."photogallery.php?photo_id=".$data['photo_id']."' class='gallery'>
<img src='".$rphoto."' alt='".$data['photo_title']."' title='".$data['photo_title']."' border='0'>
</a><br />".$data['photo_title']."
<br />
<a href='".BASEDIR."photogallery.php?album_id=".$data['album_id']."'>".$data['album_title']."</a>
</div><br />";
}
@closeside();
}
?><!--c2--></div><!--ec2-->