It occurred to me that I tried to do this, but it seems to be wrong. Is it possible?
//EVITANDO DUPLICIDADE
if ($legenda > "0") {
SELECT legenda FROM aula_upload_arquivo WHERE legenda = $legenda;
echo 'Existe esse arquivo';
} else {
echo 'Não existe o arquivo';
}