Home > Backend Development > PHP Tutorial > 插入sql语句时出错,把异常内容写log

插入sql语句时出错,把异常内容写log

WBOY
Release: 2016-06-13 13:39:51
Original
967 people have browsed it

插入sql语句时出错,把错误内容写log
接口文件往数据库中插入数据,如果没有执行成功,如何把报的错误写在log里面?

------解决方案--------------------
insert失败后,记录mysql_error()就可以了。
------解决方案--------------------
mysqli_error 需要传递参数进去,但是你没传递进去.

$link=mysqli_conn...

mysqli_error($link);
------解决方案--------------------
mysql_error()就可以
如果是mysqli_error(),需要加一个mysqli对象的参数

http://www.nusphere.com/kb/phpmanual/function.mysqli-error.htm

Related labels:
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