prova così

if ($row['foto']!= ' ')


per quanto riguarda l'echo invece va bene quello che ti hanno gia detto