I've programmed a small class to access a MySQL database, on LOCALHOST it works fine, no problem, but on all the commercial hosts I get the following errors:
Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) in /www.ita-studio.com/forum/classes/db.class.php on line 95
Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) in /www.ita-studio.com/forum/classes/db.class.php on line 95
Where is my mistake???
Here are the functions to connect to the db in the class:
function connect() {
$this->dbconnection = mysql_connect("$this->dbhost", "$this->dbuser", "$this->dbpassword");
if ($this->dbconnection == 1) {
$this->db = mysql_select_db("$this->db",$this->dbconnection);
$this->setdbconnection(1);
} else {
$this->setdbconnection(0);
return false;
}
return true;
}//end function connect()