• 29-11-2022, 14:29:22
    #1
    Önceki web sitemde kullandığım silme sorgusu baska yaptığım web sitede calışmamakta
    normalde sorgumda isset yoktu Warning: Undefined array key "commentsdelete" hatası verince isset ekledim hata gitti lakin bu kezde sorgu calısıyor ifdende geçiyor gettende yorum-basariyla-silindi geliyor ama yorumu silmiyor

                          <?php
                              $commentsor=$db->prepare("select * from comment order by comment_id ASC");
                              $commentcek=$commentsor->fetch(PDO::FETCH_ASSOC);
                              $commentsor->execute();
                              while($commentcek=$commentsor->fetch(PDO::FETCH_ASSOC)){ ?>
                                <tr style="text-align: left;">
                                    <td><?php echo $commentcek['comment_id']; ?></td>
                                    <td><?php echo $commentcek['comment_adsoyad']; ?></td>
                                    <td><?php echo $commentcek['comment_eposta']; ?></td>
                                    <td><?php echo $commentcek['comment_yorum']; ?></td>
                                    <td><?php echo $commentcek['comment_tarih']; ?></td>
                                <td class="project-actions">
                                
                                <a href="../db/process.php?commentsdelete=ok&comment_id =<?php echo $commentcek ['comment_id']; ?>" onclick="return commentsdelete();">
                                    <i class="fa fa-eye"></i>
                                </a>
                            </td>
                        </tr>
                    <?php } ?>
    if (isset($_GET['commentsdelete'])=="ok")  {
        $sil=$db->prepare("DELETE from comment where comment_id=:comment_id");
        $kontrol=$sil->execute(array(
            'comment_id' => $_GET['comment_id']
        ));
        if ($kontrol) {
            header("Location:../panel/comments.php?durum=yorum-basariyla-silindi");
        } else {
            header("Location:../panel/comments.php?durum=yorum-silme-basarisiz");
        }
    }
    <script type="text/javascript">
       function commentsdelete()
       {
        var onay;
        onay=window.confirm(" Seçtiğiniz Yorumu Silmek İstiyormusunuz?");
        if(onay)
        {
         return true;
       }
       else
       {
         return false;
       }
     }
    </script>
  • 29-11-2022, 15:37:16
    #2
    execute içindeki array i silip dener misin hocam?