prova così:
codice:
$num_commenti = "SELECT COUNT(*) FROM commenti where foto='{$immagine}'";