Home >Backend Development >PHP Tutorial > The mysql extension is deprecated and will be removed in the future,这是什么原因啊解决方法
The mysql extension is deprecated and will be removed in the future,这是什么原因啊?
我在我的电脑上配置了2-plan-team这个系统,这是用PHP写的,配置完后,打开index.php,却出现以下问题:PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in E:\server\2-plan-team\include\class.datenbank.php on line 38
class.datenbank.php的源代码:
/*
* The class datenbank (database) provides methods to handle a database connection
*
* @author original code from Open Dynamics.
* @name datenbank
* @version 0.4.6
* @package 2-plan
* @link http://2-plan.com
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License v3 or later
*/
class datenbank
{
/*
* Constructor
*/
function __construct()
{
}
/*
* Establish a database connection
*
* @param string $db Database name
* @param string $user Database user
* @param string $pass Password for database access
* @param string $host Database host
* @return bool
*/
function connect($db_name, $db_user, $db_pass, $db_host="localhost")
{
//mysql
//$db = new PDO("mysql:host=$db_host;dbname=$db_name", $db_user, $db_pass);
$conn = mysql_connect($db_host,$db_user,$db_pass);
$db_check = mysql_select_db($db_name);
if($db_check)
{
return true;
}
else
{
return false;
}
}
/*
* Wrap mysql_query function