segun esta linea..
$sql = "SELECT fotos FROM $tbl_name LIMIT $start, $limit";
$result = mysql_query($sql);
es $sql la variable que hace la consulta por lo que si quiere hacer un while deberia hacer...
Código PHP:
<?php
while($row = mysql_fetch_array($sql))
{
// Your while loop here
}
?>
pruebe y nos comenta