您的位置:首页 > 编程语言 > PHP开发

2015-3-18 学习出错问题解决--PHP Deprecated问题

2015-03-19 09:47 309 查看
系统:windows 10 10036

环境:Apache2.4 + php 5.6.5 + mysql 5.5
学习内容:PHP连接数据库 分别有mysqli mysql
出现的问题 :
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in D:\wamp\www\0316\phpdev_connect.php on line8
解决办法:
一、
禁止php报错:
display_errors = on
改为
display_error = off
二、
在代码里添加:
error_reporting(E_ALL ^E_DEPRECATED);

三、
hod to solve the warnings?
currently mostly many mysql connection in php use this construct
mysql:

$link = mysql_connect('localhost','user','password');
mysql_select_db('dbname',$link);
mysqli:
$link = mysqli_connect('localhost','user','password','dbname');
To run databae queries is also simple and nearly identical with the old way:

//old
mysql_query('create temporary table `table`',$link);
//new
msyqli_query($link,'create temporary table `table`');


filthy and fastest solutin:
<?php
error_reportion(E_ALL ^E_DEPRECATED);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php error deprecated
相关文章推荐