<?php
header("content-type:text/html;charset=utf-8");
try {
$pdo = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$sql = "UPDATE user SET username='imooc' WHERE id=1;";
$res = $pdo->exec($sql);
echo $res . "条记录被影响";//1
} catch (PDOException $e) {
echo $e->getMessage();
}
?>
$sql = "DELETE FROM user WHERE id=1;";