Recently in the use of the CI framework, but the inside of the database operation is not thinkphp convenient, do not know the database operation feedback information, had to rely on the native method to determine whether the operation of the database success
Determine if PHP operation MySQL (Tim pruning) success, mainly with the help of two functions
1. Mysql_num_rows (data) function returns the number of rows in the result set
2.the Mysql_affected_rows () function returns the number of record rows affected by the previous MySQL operation
Mysql_num_rows (data) is primarily used for select operations, with three cases of return values
1. Return of 0 indicates that the select Gets a value of 0 and does not get any results
2. The return value is NULL, indicating that the previous SELECT statement has an error
3. The return value is greater than 0, indicating the number of rows that meet the criteria
Mysql_affected_rows () is mainly used for INSERT, UPDATE, delete three operations
1. A return value of 0 means that the number of rows affected is 0
2. A return value of 1 indicates a problem with the previous SQL statement
3. The return value greater than 0 indicates the number of rows affected
Determine if the PHP operation MySQL (Tim pruning) is successful