Codice PHP:
connessione al db...

$get_data "SELECT * FROM tabella";

$result mysql_query($get_data$conn);

while(
$row mysql_fetch_array($result)){

if(
$row[campo_foto]){
// c'è la foto

print $row[campo_foto];

}else{
// non c'è la foto

print "la foto non c'è";

}

}

mysql_close($conn);