2021年3月7日星期日

Delete SQL Row with PHP Variable

I am kinda new to PHP and had a question. So basically, I am working on an admin panel for a site I'm making and here's what I am working on.

<?php      $conn = mysqli_connect("server", "username", "password","database");      if ($conn-> connect_error) {        die("Connection failed:". $conn-> connect_error);      }    $id = "";  ?>    <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">      ID: <input type="text" name="id" value="<?php echo $id;?>">    <input type="submit" name="submit" value="Submit">    </form>    <?php  $sql= "DELETE FROM users WHERE id = $id"  ?>  

I am trying to make an input that can delete a row in the table from the ID.

https://stackoverflow.com/questions/66517759/delete-sql-row-with-php-variable March 07, 2021 at 10:47PM

没有评论:

发表评论