Someone can tell me what I doing wrong ? my code is deleting a product from a database and I want to delete the image of that product
my code
if((isset($GET["remove"])) && ($GET["remove"] != "")){
$idproduct = $_GET["remove"];
$sql = "DELETE FROM products WHERE idproduct = '".$idproduct."'";
$query = mysqli_query($connect, $sql) or die ("Error");
while($result = mysqli_fetch_assoc($query)){
unlink($frontpage_url."/images/".$result['imagem']);
echo "success";
}
}
this is the error that give me
WARNING: MYSQLI_FETCH_ASSOC() EXPECTS PARAMETER 1 TO BE MYSQLI_RESULT, BOOLEAN GIVEN IN /HOME/HOSTING/ALUNOS.ETIC.COM/PUBLIC_HTML/EA_A40489/PROJECTO/BACKOFFICE/PRODUTOS.PHP ON LINE 11