Mysql method to determine whether SQL statement is executed successfully

WBOY
Release: 2016-07-25 09:00:31
Original
2938 people have browsed it
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());
Copy after login


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!