c - How to get mysql to throw an error on update for no rows matched? -


i want know when update query reports 0 rows matches. i'm using libmysql.

here's code i'm using:

char query[300] = {0}; snprintf(query, 300, "update `my_table` set name='%s' id=%d",          name, id);  if (mysql_query(db, query)) {     printf("error!\n"); } 

essentially need know whether or not there match id. know can check doing select, there way?

check mysql_affected_rows. return number of modified rows last query.

however, may return rows modified. if want return matched row, have specify client_found_rows in mysql_real_connect. check same page details.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -