Delete Data In a Database in PHP

Description

The following code shows how to delete Data In a Database.

Example


  //w  w w.  jav a2 s .  c  o  m
<?php
    $con=mysqli_connect("example.com","root","","test");
    // Check connection
    if (mysqli_connect_errno()) {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
    
    mysqli_query($con,"DELETE FROM employee");
    
    mysqli_close($con);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    MySQL »




MySQLi
MySQLi Object Oriented