Working on an old website (PHP 3), I need to update its code, notably this DB connection class (mysql_db_query seems deprecated) :
class db {
var $host;
var $port;
var $login;
var $pass;
var $data_base;
function db(){
$this->host = "";
$this->port = "";
$this->login = "";
$this->pass = "";
$this->data_base = "";
}
function connect() {
return mysql_connect($this->host.':'.$this->port, $this->login, $this->pass);
}
function query( $query ){
if ( $query )
return mysql_db_query($this->data_base,$query);
return mysql_query($query);
return 0;
}
function close( $link ){
mysql_close($link);
}
}
Could anyone tell me how to update it?
Thank you by advance for your help.
No comments:
Post a Comment