I have been working on a registration system for a while. The data interacting with db is pretty sensitive so I'm trying to pay extra attention to details. This is an example of how I do inserts.
try{
$query="INSERT INTO account (user_id,password,salt) VALUES (:user_id,:password,:salt)";
$stmt=$db->prepare($query);
$params=array(':user_id'=>$userId,':password'=>$password,':salt'=>$salt);
$result=$stmt->execute($params);
if(!$result){
$db->rollBack();
doStaff();
}
}
catch(PDOException $e){
$db->rollBack();
doStaff();
}
I was wondering if there is any scenario that the result of an execute operation returns false but pdo does not throw exception? Should I check them both, or am I being paranoid?