Php 防止删除ID 1

Php 防止删除ID 1,php,mysqli,Php,Mysqli,我有一个获取帐户ID并在数据库中删除它的代码 但是我需要防止ID 1被删除 我该怎么做 <?php // connect to the database include('dbconn.php'); // confirm that the 'id' variable has been set if (isset($_GET['admin_ID']) && is_numeric($_GET['admin_ID'])) {

我有一个获取帐户ID并在数据库中删除它的代码 但是我需要防止ID 1被删除

我该怎么做

   <?php

    // connect to the database
    include('dbconn.php');

    // confirm that the 'id' variable has been set

    if (isset($_GET['admin_ID']) && is_numeric($_GET['admin_ID']))
    {
    // get the 'id' variable from the URL
    $id = $_GET['admin_ID'];

    // delete record from database
    if ($stmt = $con->prepare("DELETE FROM tbl_admin WHERE admin_ID = ? LIMIT 1"))
    {
    $stmt->bind_param("i",$id);
    $stmt->execute();
    $stmt->close();
    }
    else
    {
    echo "ERROR: could not prepare SQL statement.";
    }
    $con->close();

    // redirect user after delete is successful
    header("Location: DeleteAdmin.php");
    }
    else
    // if the 'id' variable isn't set, redirect the user
    {
    header("Location: DeleteAdmin.php");
    }

    ?>

更改
从tbl\U admin删除,其中admin\U ID=?将1限制为从tbl\U admin删除,其中admin\U ID=?和管理员ID!=1

假设您是主id,则没有必要使用
限制1
,因此不可能有两个id相同。

检查
id
,如果有,则不操作删除查询。
其中admin\u id 1
您正在代码中使用if语句,因此不确定您还需要知道什么。