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();
?>