Friday, 28 July 2017

php - Old database connection class with functions deprecated

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

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...