// Connect to database $conn = mysqli_connect("localhost", "username", "password", "database"); // Delete user $user_id = 1; $sql = "DELETE FROM users WHERE id = '$user_id'"; mysqli_query($conn, $sql);
// Connect to database $dsn = 'mysql:host=localhost;dbname=database'; $username = 'username'; $password = 'password'; $dbh = new PDO($dsn, $username, $password); // Delete user $user_id = 1; $stmt = $dbh->prepare("DELETE FROM users WHERE id = ?"); $stmt->bindParam(1, $user_id); $stmt->execute();In the above examples, we are deleting a user with an ID of 1 from a table named "users" in a database. The package library used in these examples is either MySQLi or PDO, depending on the extension used to connect to the database. Both extensions are part of the core PHP language and do not require any additional packages or libraries to be installed.