Deprecated: mysql_connect()

前端 未结 15 1144
醉酒成梦
醉酒成梦 2020-11-22 06:55

I am getting this warning, but the program still runs correctly.

The MySQL code is showing me a message in PHP:

Deprecated: mysql_connect(): T

15条回答
  •  旧时难觅i
    2020-11-22 07:39

    PDO class replaces these methods. Example for Mysql or MariaDB :

    $BDD_SQL = new PDO('mysql:host='.BDD_SQL_SERVER.';dbname='.BDD_SQL_BASE.';charset=utf8', 
            BDD_SQL_LOGIN, BDD_SQL_PWD, 
            array(
              PDO::ATTR_EMULATE_PREPARES => false,
              PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, //launch exception if error
              PDO::ATTR_DEFAULT_FETCH_MODE=> PDO::FETCH_ASSOC
                    ));
    

    Source : PDO Class

提交回复
热议问题