Home > php教程 > php手册 > 为你详细解读PHP函数mysql_error()

为你详细解读PHP函数mysql_error()

WBOY
Release: 2016-06-13 11:12:02
Original
1426 people have browsed it

在我们运用

PHP函数mysql_error()的语法格式如下:

string mysql_error ( [resource $link_identifier] )

PHP函数mysql_error()将返回上一个MySQL函数生成的错误信息,若无错误则返回一个空字符串。

使用mysql_error()函数的示例代码如下:

<ol class="dp-xml">
<li class="alt"><span><span class="tag"><span> ?php  </span></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>
</li>
</ol>
Copy after login

以上就是PHP函数mysql_error()的具体使用方法。


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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template