$stmt = $pdo->prepare("INSERT INTO users (name, email) VALUES (:name, :email)"); $stmt->bindParam(':name', $name); $stmt->bindParam(':email', $email); $name = "John Doe"; $email = "john.doe@example.com"; $stmt->execute();
$stmt = $pdo->prepare("UPDATE users SET email = :email WHERE id = :id"); $stmt->bindParam(':email', $email); $stmt->bindParam(':id', $id); $email = "john.smith@example.com"; $id = 1; $stmt->execute();
$stmt = $pdo->prepare("DELETE FROM users WHERE id = :id"); $stmt->bindParam(':id', $id); $id = 1; $stmt->execute();The PHP DB exec method is a part of the PHP Data Objects (PDO) Library.