php - MySQL error message, mysql_connect(), any way to fix it? -
so error message:
php deprecated: mysql_connect(): mysql extension deprecated , removed in future: use mysqli or pdo instead
this affected piece of code:
class wdclient { var $dblink; // database link var $prefix; // table prefix var $script; // script running /** * construct new directory object. */ function wdclient() { error_reporting(e_all ^ e_notice); $this->prefix = wddbprefix; // connect database $this->dblink = mysql_connect(wddbhost, wddbuser, wddbpasswd); // select database mysql_select_db(wddbname, $this->dblink) or die('sorry, site unavailable!'); }
where wddbprefix
, wddbhost
, wddbuser
, wddbpasswd
, wddbname
defined in config file.
i have tried using mysqli_connect
instead of mysql_connect
it's not working.
note: never use mysql, use method!
//mysqli information $db_host = "localhost"; $db_username = "username"; $db_password = "password"; //connect mysqli database (host/username/password) $connection = mysqli_connect($db_host, $db_username, $db_password) or die("error " . mysqli_error()); //select mysqli dabatase table $db = mysqli_select_db($connection, "table") or die("error " . mysqli_error());
good luck!
Comments
Post a Comment