Code has been added to clipboard!

Deleting MySQL Row Content

Example
<?php
  $host = 'host';
  $user = 'user';
  $pass = 'pass';
  $db = 'db';
  // Create connection  
  $conn = mysqli_connect($host, $user, $pass, $db);  	
  // Check connection  	
  if (!$conn) { 
    die("Connection failed: " . mysqli_connect_error());
  }
  // sql to delete a record 
  $sql = "DELETE FROM users WHERE user_id=3";  	
  if (mysqli_query($conn, $sql)) { 
    echo "Record deleted successfully";
  } else { 
    echo "Failed to delete: " . mysqli_error($conn);
  }
  mysqli_close($conn); 
?>