este metodo funciona
Código PHP:
<?php
class basedatos{
private $bd_cn;
private $bd_rs;
private static $bd_name=BD_NAME;
private static $bd_server=BD_SERVER;
private static $bd_user=BD_USER;
private static $bd_pwd=BD_PWD;
function __construct(){
$this->bd_cn= mysql_connect(self::$bd_server,self::$bd_user,self::$bd_pwd);
mysql_select_db(self::$bd_name);
}
public function consulta($str_sql){
$this->bd_rs=mysql_query($str_sql,$this->bd_cn)or die("errorrrrr");
}
public function obtener_datos($tipo_rs=MYSQL_NUM){
return mysql_fetch_array($this->bd_rs,$tipo_rs);
}
public function liberar_datos(){
mysql_free_result($this->bd_rs);
}
function __destruct(){
mysql_close($this->bd_cn);
}
}
?>
Código PHP:
<?php
class basedatos{
var $bd_cn;
var $bd_rs;
var $bd_name=BD_NAME;
var $bd_server=BD_SERVER;
var $bd_user=BD_USER;
var $bd_pwd=BD_PWD;
function basedatos(){
$this->bd_cn = mysql_connect($this->bd_server,$this->bd_user,$this->bd_pwd);
mysql_select_db($this->bd_name);
}
function consulta($str_sql){
$this->bd_rs = mysql_query($srt_sql,$this->bd_cn) or die("errorrr"); // aqui me sale el error
}
function obtener_datos($tipo_rs=MYSQL_NUM){
return mysql_fetch_array($this->bd_rs,$tipo_rs);
}
function liberar_datos(){
mysql_free_result($this->bd_rs);
}
function desconectar(){
mysql_close($this->bd_cn);
}
}?>
al parecer no puede asignar el valor que mysql_query a $this->bd_rs