无法在php和mysql中删除用户

vmjh9lq9  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(162)

我想删除一个用户,但当我点击垃圾(删除)图标。我有一个完全空白的页面,这是我面临的问题。我在这方面做了很多尝试,但我也面临同样的问题。我认为它不在数据库中,用户的问题可能在代码中。这是我的php代码。

//dash.php
 <?php
     if(@$_GET['q']==1) {

        $result = mysqli_query($con,"SELECT * FROM user") or die('Error');
        echo  '<div class="panel"><div class="table-responsive"><table class="table table-striped title1">
        <tr><td><b>S.N.</b></td><td><b>Name</b></td><td><b>Gender</b></td><td><b>College</b></td><td><b>Course</b></td><td><b>Email</b></td><td><b>Mobile</b></td><td></td></tr>';
        $c=1;
        while($row = mysqli_fetch_array($result)) {
            $name = $row['name'];
            $mob = $row['mob'];
            $gender = $row['gender'];
            $email = $row['email'];
            $college = $row['college'];
          $course = $row['course'];

            echo '<tr><td>'.$c++.'</td><td>'.$name.'</td><td>'.$gender.'</td><td>'.$college.'
</td><td>'.$course.'</td><td>'.$email.'</td><td>'.$mob.'</td>
            <td><a title="Delete User" href="update.php?demail='.$email.'">
<b><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></b></a></td></tr>';
        }
        $c=0;
        echo '</table></div></div>';

        }
        ?>

            //update.php
            <?php
            include_once 'dbConnection.php';
            session_start();
            $email=$_SESSION['email'];
            //delete feedback
            if(isset($_SESSION['key'])){
            if(@$_GET['fdid'] && $_SESSION['key']=='bondad7785068889') {
            $id=@$_GET['fdid'];
            $result = mysqli_query($con,"DELETE FROM feedback WHERE id='$id' ") or die('Error');
            header("location:dash.php?q=3");
            }
            }

            //delete user

            if(isset($_SESSION['key'])){
            if(@$_GET['demail'] && $_SESSION['key']=='bondad7785068889') {
            $demail=@$_GET['demail'];
            $r1 = mysqli_query($con,"DELETE FROM rank WHERE email='$demail' ") or die('Error');
            $r2 = mysqli_query($con,"DELETE FROM history WHERE email='$demail' ") or die('Error');
            $result = mysqli_query($con,"DELETE FROM user WHERE email='$demail' ") or die('Error');
            header("location:dash.php?q=1");
            }
            }
            ?>

             //dbConnection.php

以下是截图:
以下是用户的截图
空白页(错误)
在数据库表中:用户

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题