PHP extension MySQL mysqli
I configured on my Computer 2-plan-team this system, which is written in PHP, after configuration, open index.php, but the following problems: Php Deprecated:mysql_connect (): The MySQL extension is Deprecated and would be removed in the Future:use mysqli or PDO instead in E:\SERVER\2-PLAN-TEAM\INCLUDE\CLASS.DATENBANK.P HP on line 38
Source code for 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
*
* @param string $str SQL search Query
* @return BOOL
*/
function query ($STR)
{
return mysql_query ($STR);
}
}
?>
I use the server is IIS, I would like to ask you heroes what causes the above problems, how to solve ah?
Reply to discussion (solution)
What version of PHP are you in?
The error message is that mysql_connect is obsolete and will be removed in the future, with mysqli or PDO instead.
You can change the error level to temporarily mitigate:
PHP.ini in order: Error_reporting=e_all & ~e_notice & ~e_deprecated
Remember to restart the server to take effect.
My PHP version is 5.5.3
What version of PHP are you in?
The error message is that mysql_connect is obsolete and will be removed in the future, with mysqli or PDO instead.
You can change the error level to temporarily mitigate:
PHP.ini in order: Error_reporting=e_all & ~e_notice & ~e_deprecated
Remember to restart the server to take effect.
Okay, I'll try.
I was so puzzled that I used PDO to build the object, and then the following line was mysql_connect!
This code wasn't written by itself.
I was so puzzled that I used PDO to build the object, and then the following line was mysql_connect!
This code wasn't written by itself.
I didn't write it, it's an open-source system, someone else wrote it.