Heim  >  Artikel  >  Datenbank  >  【解决方案】Deprecated: mysql

【解决方案】Deprecated: mysql

WBOY
WBOYOriginal
2016-06-07 15:40:281223Durchsuche

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in F:\Program Files (x86)\wamp\www\testmysql.php on line 2 ?php $link = mysql_connect(localhost,root,); if (!$link)

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in F:\Program Files (x86)\wamp\www\testmysql.php on line 2

【解决方案】Deprecated: mysql

<?php $link = mysql_connect(&#39;localhost&#39;,&#39;root&#39;,&#39;&#39;); 
if (!$link) { 
	die(&#39;Could not connect to MySQL: &#39; . mysql_error()); 
} 
echo &#39;Connection OK&#39;; mysql_close($link); 
?> 


解决方案

将mysql改为mysqli

<?php &#160;
$link = mysqli_connect(&#39;localhost&#39;,&#39;root&#39;,&#39;&#39;);&#160;
if (!$link) {&#160;
<span style="white-space:pre">	die('Could not connect to MySQL: ' . mysqli_error()); 
} 
echo 'Connection OK'; mysqli_close($link); 
?> 

【解决方案】Deprecated: mysql


作者:Jackson 出处:http://blog.csdn.net/jackson0714/article/details/44116601


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