Código PHP :
if( basename( $_SERVER['PHP_SELF'] )== "conexion.php" )
exit;
class conect
{
private $host;
private $root;
private $pass;
private $db;
public function dbconect($host,$root,$pass,$db)
{
$this->host = $host;
$this->root = $root;
$this->pass = $pass;
$this->db = $db;
$this->conexion = mysql_pconnect($this->host,$this->root,$this->pass);
mysql_query("SET NAMES 'utf8'");
mysql_select_db( $this->db, $this->conexion );
}
//se cierra la conexión
public function dbcerrar()
{
mysql_close($this->conexion);
}
//
}
$conexion=new conect();
$conexion->dbconect("localhost","tnkvzsvo_root","991237581","tnkvzsvo_hl");Consulta que da error:
Código PHP :
mysql_select_db($database_conexion, $conexion); $query_SacarDatos = "SELECT * FROM h_datos"; $SacarDatos = mysql_query($query_SacarDatos, $conexion) or die(mysql_error()); $row_SacarDatos = mysql_fetch_assoc($SacarDatos); $totalRows_SacarDatos = mysql_num_rows($SacarDatos); mysql_free_result($SacarDatos);
Error:
Warning: mysql_select_db() expects parameter 2 to be resource, object given in /home/tnkvzsvo/public_html/include/funciones.php on line 36
Warning: mysql_query() expects parameter 2 to be resource, object given in /home/tnkvzsvo/public_html/include/funciones.php on line 38
Ya llame la variable $conexion no se porque no me la toma como debería ser
