We can run our edit and delete queries with the exec
method, which works in the same way as the insert method above. The only difference is this time we get the number of rows affected.
<?php
//update
$affected = DB::exec('UPDATE users SET scores = 10 WHERE id > 30');
echo $affected . ' users updated.';
//delete
$affected = DB::exec('DELETE FROM users WHERE id < 30');
echo $affected . ' users deleted.';
?>