When launching a INSERT MySql with PDO I have the same result whether the update is done or not, as long as no errors occur, ie if for example the update does not meet the conditions of WHERE
will not occur.
Example:
$sql = "UPDATE score SET bonus=1000 WHERE player='Anubis'";
$query = $con->prepare( $sql );
$res = ( $query )
? $query->execute()
: NULL ;
var_dump( $res );
The above, whether or not the player named Anubis is found, throws the same result.
There is a direct way to check that the INSERT was fine on the $ res variable, or the only way is to run the update and then launch one with rowCount () :
$sql = "UPDATE score SET bonus=1000 WHERE player='Anubis'";
$query = $con->prepare( $sql );
$query->execute();
$res = $query->rowCount();
var_dump( $res );
I understand that doing it this way, two calls are being made to the BD instead of just one, the first for the update and the second to check the number of affected rows.