Home >Backend Development >PHP Tutorial >Mysql method to determine whether SQL statement is executed successfully

Mysql method to determine whether SQL statement is executed successfully

WBOY
WBOYOriginal
2016-07-25 09:00:313015browse
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());


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn