I am trying to use the unlink to delete from a directory several images I do not know what is happening apparently the logic is correct, my method is as follows:
public function deleteImagem($id) {
$selectDasImagens = PDOUtil::getStance()->prepare("select nome FROM imagem where id_pagina=:id");
$selectDasImagens->bindValue(":id", $id);
$selectDasImagens->execute();
while ($linha = $selectDasImagens->fetch(PDO::FETCH_OBJ)) {
echo unlink("../uploaded/$linha->nome");
}
}
Someone has already gone through this.