<?php
//The code example deletes three rows. It prints the number of affected rows.
$dsn = "mysql:host=localhost;dbname=mydb";
$user = "user12";
$passwd = "12user";
$pdo = new PDO($dsn, $user, $passwd);
$id = 12;
//In this SQL statement, we delete rows with ids 1, 2, and 3. The number of deleted rows is stored in the $nrows variable.
$nrows = $pdo->exec("DELETE FROM countries WHERE id IN (1, 2, 3)");
//We print the number of deleted rows.
echo "The statement affected $nrows rows\n";
?>