conexion.php
Código PHP:
<?
class conexion{
//Atributos
var $id_conn;
var $dir_serv;
var $contr;
var $usuario;
//Constructores
function conexion($x,$y,$z){
$this->dir_serv=$x;
$this->contr=$y;
$this->usuario=$z;
}
//Metodos
function conectar(){
if($this->id_conn=mysql_connect($dir_serv,$contr,$usuario)){
echo "Conexion correcta";
}
else{
echo "Murio";
}
}
}
?>
Código PHP:
<?
include_once("conexion.php");
$con1=new conexion("direccion","usuario","contraseña");
$con1->conectar();
?>
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/vhost/adosinformatica.com/home/html/conexion.php on line 19
Murio