【解决方案】Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed

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) { 
	die('Could not connect to MySQL: ' . mysql_error()); 
} 
echo 'Connection OK'; mysql_close($link); 
?> 


解决方案

将mysql改为mysqli

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



作者:Jackson 出处:http://blog.csdn.net/jackson0714/article/details/44116601 本文版权归作者和CSDN博客共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。如果觉得还有帮助的话,可以点一下“顶”,希望能够持续的为大家带来好的技术文章!想跟我一起进步么?那就【关注】我吧。


发布了40 篇原创文章 · 获赞 4 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/jackson0714/article/details/44116601
今日推荐