Solution Deprecated:mysql_connect (): The MySQL extension is deprecated and would be removed in the Future:use mysqli or PDO Inst EAD In,pdomysqli
PHP 5 version, 5.2, 5.3, 5.4, 5.5, afraid to keep up with the times, the new server directly on the 5.5, but the program appears the following error: Deprecated:mysql_connect (): The MySQL extension is Deprecated And will is removed in the Future:use mysqli or PDO instead in, see the meaning is very clear, said mysql_connect This module will be deprecated in the future, please use MYSQLI or PDO instead.
Workaround 1:
Prohibit PHP error
123 |
display_errors = on change to display_errors = Off |
Since this server is for users, sometimes they need to make an error (...). Are for friends, ^_^), can not do this, let them change the program bar, see Program 2.
Workaround 2:
Common PHP syntax to connect MySQL is as follows
1234567 |
<? PHP $link = mysql_connect(' localhost ', ' user ', ' password ') );mysql_select_db(' dbname ', $link); Change intoMysqi<? PHP $link = mysqli_connect(' localhost ', ' user ', ' Password ', ' dbname '); |
MySQL is commonly used to build table SQL as follows
12345 |
<? PHP//Old mysql_query(' CREATE temporary table ' table ', $Link ); //New mysqli_query($link, ' CREATE temporary table ' table '); |
Workaround Three:
Set the alarm level in the PHP program code
12 |
<? PHPerror_reporting(e_all ^ e_deprecated); |
Deprecated's problem is solved, but it is recommended that you cancel the use of MySQL as soon as possible, all toward mysqli or Mysqlnd and so on. MySQL is really too insecure and too old.
From: https://www.ttlsa.com/php/deprecated-mysql-connect/
http://www.bkjia.com/PHPjc/1110974.html www.bkjia.com true http://www.bkjia.com/PHPjc/1110974.html techarticle Solution Deprecated:mysql_connect (): The MySQL extension is deprecated and would be removed in the Future:use mysqli or PDO Instead in,pdomysqli PHP5 versions, 5.2, 5.3, 5.4, 5.5, ...