Home > Backend Development > PHP Tutorial > A detailed explanation of the PHP function mysql_error()_PHP tutorial

A detailed explanation of the PHP function mysql_error()_PHP tutorial

WBOY
Release: 2016-07-15 13:35:13
Original
1165 people have browsed it

The syntax format of the PHP function mysql_error() when we use

is as follows:

string mysql_error ([resource $link_identifier])

The PHP function mysql_error() will return the error message generated by the previous MySQL function, or an empty string if there is no error.

The sample code for using the mysql_error() function is as follows:

<ol class="dp-xml"><li class="alt"><span><span class="tag"><</span><span> ?php  </span></span></li><li><span>$</span><span class="attribute">connection</span><span>=</span><span class="attribute-value">mysql_connect<br /></span><span>("localhost","root","root") <br />or die("连接服务器失败");  </span></li><li class="alt"><span>mysql_select_db("mydb",$connection);  </span></li><li><span>echo "错误信息:".mysql_error();  </span></li><li class="alt"><span class="tag">?></span><span> </span></span></li></ol>
Copy after login

The above is the specific use of the PHP function mysql_error().


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445929.htmlTechArticleThe syntax format when we use the PHP function mysql_error() is as follows: string mysql_error ([resource $link_identifier]) PHP function mysql_error() will return the error message generated by the previous MySQL function...
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