Code has been added to clipboard!

Deleting MySQL Row Content for MySQLi Users

Example
<?php
  $host = 'host';
  $user = 'user';
  $pass = 'pass';
  $db =  'db';
  // Create connection
  $conn = new mysqli($host, $user, $pass, $db);
  // Check connection
  if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
  }
  // sql to delete a record 
  $sql = "DELETE FROM users WHERE user_id=3";  	
  if ($conn->query($sql) === TRUE) {    
    echo "Record deleted successfully";
  } else { 
    echo "Failed to delete: " . $conn->error;
  }
  $conn->close();  
?>