I am executing SQL (MySQL) commands from PHP. There are several possible outcomes to each execution:
- Record updated to new value
- Record updated, but values happen to be the same
- Record finds no rows to update (ie, no rows match the
WHERE
clause)
I am wondering how to differentiate between #'s 1 and 3: both cases return zero as the number of rows being affected, so:
$result = $db->exec($statement)
will have $result == 0
in both cases. How can I tell the difference?
EDIT: I meant to ask how to differentiate between scenarios TWO and 3, not 1 and 3! Sorry for the inconvenience...