Hi,
I wrote a conection class that doesn't work and i can't figure out why. Maybe someone sees what i dont. Thanks.
Here's the code:
class conectare
{
private $server;
private $username;
private $passwd;
private $conect;
public $db;
function __construct($db)
{
$this->server="localhost";
$this->username="user";
$this->passwd="pass";
$this->conect="mysql_connect($this->server,$this->username,$this->passwd)";
$this->db=$db;
mysql_select_db($this->db) or die ("Cannot connect!");
}
}
And then create the instance in the file i need it:
$obj=new conectare("mydatabase");
The only message i get is "Cannot connect". It doesn't execute the mysql_select_db part. WHY?