Welcome Guest, Not a member yet? Register   Sign In
extends MY_Model call twice the __contruct
#1

[eluser]Unknown[/eluser]
I have a problem when i try to extends my_model it's call twice the first time is called without parameters, here is the code

MY_Model
Code:
class MY_Model extends CI_Model{
  
public $multiple_array=array();
public $multiple_key=false;

function __construct($tabla='',$id='') {
        parent::__construct();
       $this->load->database();//carga las librerias para manejar db
        $this->tabla=$tabla;
$this->id=$id;
echo "example";  
}
    }

and Prueba_mod
Code:
class Prueba_mod extends MY_Model{
function __construct(){
  parent::__construct("carrera");
  //echo "asdas";
}
}
The echo in the file MY_Model.php will echo twice "example" and if i extends CI_Model it will echo once example.
i would like to understand this behaviour and control it to extends MY_Model and just call once the constructor




Theme © iAndrew 2016 - Forum software by © MyBB