+ 5
You can combine multiple statements separated by semicolon; in a single
$sql = "
delete from user;
insert into
user (username, password)
values ('johndoe', '1234');
";
$stmt = $db->prepare($sql);
$stmt->execute();
Be sure to using proper encoding on data when used with execute command to prevent issues with SQL injection.