Heim  >  Artikel  >  Backend-Entwicklung  >  为你详细解读PHP函数mysql_error()_PHP教程

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

WBOY
WBOYOriginal
2016-07-15 13:35:131117Durchsuche

在我们运用

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>

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


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445929.htmlTechArticle在我们运用 PHP函数mysql_error()的语法格式如下: string mysql_error ( [resource $link_identifier] ) PHP函数mysql_error()将返回上一个MySQL函数生成的错误信...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn