PDO: check for updated or inserted record using mysql INSERT ON DUPLICATE KEY UPDATE PDO: check for updated or inserted record using mysql INSERT ON DUPLICATE KEY UPDATE php php

PDO: check for updated or inserted record using mysql INSERT ON DUPLICATE KEY UPDATE


If you use PDO::exec() the return value will be 1 if the row has been inserted and 2 if the row has been updated.

If you're using a prepared statement and PDOStatement::execute() the same is true for PDOStatement::rowCount()