Ver Mensaje Individual
  #11 (permalink)  
Antiguo 10/02/2007, 13:27
migueilichenco
 
Fecha de Ingreso: marzo-2004
Mensajes: 186
Antigüedad: 20 años, 2 meses
Puntos: 0
Re: invocar una clase en metodo de otra y parametros fijos

estuve tratando de mejorar y ampliar la casa que realize, disculparan los errores pero no entiendo muy bien algunas cosas,
Código PHP:
<?
include("infobd.php");

class 
conexion
    
{
        public 
$datos;
        public 
$cliente;
        public 
$password;
        public 
$db;
        
        function 
__construct()
        {
            
$datos Config::getInstance();
            
$this->host$datos->host;
            
$this->cliente=$datos->cliente;
            
$this->password=$datos->password;
            
$this->db=$datos->db;
                                    
        }
                
        function 
conectar()
        {

            if (!(
$link mysql_connect($this->host,$this->cliente,$this->password)))
                
                {
                    return 
"Error conectandose a la base de datos.";
                    exit();
                }
            
            if (!
mysql_select_db("$this->db",$link))
                {
                    return 
"Error seleccionando la base de datos.";
                    exit();
                }

        return 
$link;
        }
        
        function 
insertar()
        {
            
        }
        
        function 
modificar()
        {
            
        }
        
        function 
eliminar_we($tabla,$where,$valor_where)
        {
            
mysql_query("DELETE FROM $tabla WHERE $where = '$valor_where' LIMIT 1");
        }
        
        function 
eliminar($tabla)
        {
            
mysql_query("DELETE FROM $tabla LIMIT 1");
        }
        function 
consultar($select$tabla)
        {
      
            
$this->row mysql_query("SELECT $select FROM $tabla");
            
$this->result mysql_fetch_array($this->row);
              
        }
        function 
consultar_we($select$tabla$where$variable_where)
        {
      
            
$this->row mysql_query("SELECT $select FROM $tabla where $where = '$variable_where' ");
            
$this->result mysql_fetch_array($this->row);
              
        }
        
        
        function 
ver_consulta($datos)
        {
            echo 
$this->result[$datos]; 
        }
        

        
    }
?>
Tengo unas dudas:

Primero que tan cerca estoy de que estoy sea una clase bien echa para crear objetos
segundo , alguien tiene una idea de como puedo armar las funciones de insertar y modificar consultas,

gracias de antemano por sus respuestas a todos
__________________
Software a Medida
voip Locutorios