I want to know when an UPDATE
query reports 0 rows matches. I'm using libmysql
.
Here's the code I'm using:
char query[300] = {0};
snprintf(query, 300, "UPDATE `my_table` SET name='%s' WHERE id=%d",
name, id);
if (mysql_query(db, query)) {
printf("Error!\n");
}
Essentially what I need to know is whether or not there is a match for id
. I know I can check that by doing a select, but is there another way?