// Deleting a record with id = 10 from the "users" table $pdo = new PDO("mysql:host=localhost;dbname=mydb", "username", "password"); $stmt = $pdo->prepare("DELETE FROM users WHERE id = ?"); $stmt->execute([10]);
// Deleting multiple records from the "products" table based on a condition $pdo = new PDO("mysql:host=localhost;dbname=mydb", "username", "password"); $stmt = $pdo->prepare("DELETE FROM products WHERE price < ?"); $stmt->execute([50]);The package/library used for this function may depend on the database system being used. For example, for MySQL databases, the PDO extension or the mysqli extension may be used for database connectivity.