Use:
PHP Code:
if (results.AffectedRows)
Insert, update and delete queries returns only how many rows were affected.
Search for "update on duplicate key" ("insert into table on duplicate key set") - you update the data if exists or insert if don't. You can check my Activity plugin for a snippet as well.
__________________