ghergedan adlı üyeden alıntı: mesajı görüntüle
Resimleri diskten silebilmeniz için resimlere ait yolları biliyor olmanız lazım. "DELETE FROM urun_foto..." sorgusunu çalıştırmadan önce ürüne ait resim yollarını alıp resimleri diskten silin. Şu şekilde deneyebilirsiniz, muhtemelen çalışacaktır;

$resimler = $db->prepare("SELECT urunfoto_resimyol FROM urunfoto WHERE urun_id = :urun_id");
$resimler->bindValue(':urun_id', $_GET['urun_id'], PDO::PARAM_INT);
if($resimler->execute()){
    while ($resimYolu = $resimler->fetchColumn()) {
        unlink($resimYolu);
    }
}
Merhaba, şu şekilde dediğini yapmaya çalıştım ama maalesef çalışmadı

if ($_GET['urunsil']=="ok") {
    kontrolet ();
    $sil=$db->prepare("DELETE from urun where urun_id=:urun_id");
    $kontrol=$sil->execute(array(
        'urun_id' => $_GET['urun_id']
    ));

    if ($kontrol) {

        $resimler = $db->prepare("SELECT urunfoto_resimyol FROM urunfoto WHERE urun_id = :urun_id");
        $resimler->bindValue(':urun_id', $_GET['urun_id'], PDO::PARAM_INT);
        if($resimler->execute()){
            while ($resimYolu = $resimler->fetchColumn()) {
                unlink($resimYolu);
            }
        }
        
        $resimlerisil=$db->prepare("DELETE from urunfoto where urun_id=:urun_id");
        $bak=$resimlerisil->execute(array(
            'urun_id' => $_GET['urun_id']

        ));
        
        Header("Location:../production/urun.php?durum=ok");

    } else {

        Header("Location:../production/urun.php?durum=no");
    }

}