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

系统: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:

    

1
2
    $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:

      

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


filthy and fastest solutin:

1
2
    <?php
        error_reportion(E_ALL ^E_DEPRECATED);

本文转自孤舟夜航之家博客51CTO博客,原文链接http://blog.51cto.com/cysky/1622081如需转载请自行联系原作者

cysky
上一篇:控制菜单访问权限的2种思想


下一篇:信核史上最全能的新品:OSNSolution 6.3正式发布!