Home >Backend Development >PHP Tutorial >Mysql method to determine whether SQL statement is executed successfully
How to determine whether the mysql statement is executed successfully? In fact, it is very simple, just use mysql_affected_rows().
Add mysql_affected_rows() near the SQL statement. If the value of mysql_affected_rows() is "-1", the execution fails. If it is greater than or equal to 0, the statement is executed successfully! Example, mysql_affected_rows() detection value output: printf("Records deleted: %d\n", mysql_affected_rows()); |