php 5 versions, 5.2, 5.3, 5.4, 5.5, for fear of not keeping up with the times, the new server went directly to 5.5, but the following error occurred in the program:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in,
The meaning is very clear, saying that the mysql_connect module will be deprecated in the future. Please use mysqli or PDO instead.
Recommended mysql video tutorials: "mysql tutorial"
Disable php error reporting
1 2 3 | display_errors = On改为display_errors = Off |
Since this server is for users, sometimes they need to report errors (...it’s all for friends, ^_^). You can’t do this. Let them change the program. See solution 2.
The commonly used PHP syntax to connect to mysql is as follows
1 2 3 4 5 6 7 | <?php$link = mysql_connect('localhost', 'user', 'password');mysql_select_db('dbname', $link); 改成mysqi<?php$link = mysqli_connect('localhost', 'user', 'password', 'dbname'); |
The commonly used mysql table creation SQL is as follows
1 2 3 4 5 | <?php// 老的mysql_query('CREATE TEMPORARY TABLE `table`', $link);// 新的mysqli_query($link, 'CREATE TEMPORARY TABLE `table`'); |
Set the alarm level in the php program code
1 2 | <?phperror_reporting(E_ALL ^ E_DEPRECATED); |
The problem of Deprecated is solved in this way, but it is still recommended that everyone as soon as possible Cancel the usage of mysql, and move everything to mysqli or mysqlnd, etc. MySQL is indeed too insecure and too old.