How to delete database query through php?

In this code, we explain how to make a delete query in the database. when we also know how to connect and insert a value in the database. then we make a delete query in a database.here is PHP code—————-

$check=isset($_POST['check'])?TRUE:FALSE;
$productname="";
if($check)
{
    $productname=$_POST['productname'];
    $connection=mysqli_connect("localhost", "root", "", "stockmanagemant");
    $sql="DELETE from product WHERE productname='$productname'";
    echo $sql;
    $sql= mysqli_query($connection, $sql);
}

when you know how to uses $check and also know how to $connection the database from PHP.

Leave a Reply