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

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

WBOY
WBOYOriginal
2016-06-13 10:11:00955browse

插入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

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