vendredi 27 mars 2020

SQL CODE is not working On my Delete link i have set my SQL correctly

So this is my delete link

<?php                       
    while ($res = $result->fetch_assoc()): ?>
<tr>
         <td><?php echo $res['ENo']; ?></td>
         <td><?php echo $res['Lastname']; ?></td>
         <td><?php echo $res['Firstname']; ?></td>
         <td><?php echo $res['MI']; ?></td>
         <td><?php echo $res['Address']; ?></td>
         <td><?php echo $res['Gender']; ?></td>
         <td><?php echo $res['MobileNo']; ?></td>
         <td><?php echo $res['Position']; ?></td>
         <td>
            <a href="function.php?delete=<?php echo $res['ENo']; ?>" class="danger">Delete</a>
         </td>
</tr>
<?php endwhile; ?>

and this is my SQL query

if (isset($_GET['delete']))
{
    $id = $_GET['delete'];

    $d = $mysqli_query($db,"DELETE FROM `tbllist` WHERE ENo = $id") or die($mysqli->error());

    if($d){
    header("location:index.php");
    }
}

it seems ok in code but its not deleting the data in the database please help its my project for my programming subject in school




Aucun commentaire:

Enregistrer un commentaire