hola reedyseth,
el tema es que no tengo ningun bucle dentro del script.. en el unico lugar que cierro la conexion es en su clase
Código:
class Conexion {
private $_mysqli;
private $_resultSQL;
public $insert_id;
public function __construct(){
$this->_connect();
}
/******************************************
* Conectar con bd
*******************************************/
private function _connect(){
require_once('././conf/config.php');
$this->_mysqli = new MySQLi(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DB);
if($this->_mysqli->connect_errno){
throw new Exception('Imposible conectar con la base de datos');
}
if(!$this->_mysqli->set_charset('utf8')){
throw new Exception('Fallo la carga del conjunto de caracteres utf8');
}
return $this->_mysqli;
}
/******************************************
* Para exportar la conexion
*******************************************/
public function ejecutarSQL($my_query){
$this->_resultSQL = $this->_mysqli->query($my_query);
if(!$this->_resultSQL){
throw new Exception('Se produjo un error al intentar enviar la consulta.');
}
if($this->_mysqli->insert_id){ $this->insert_id = $this->_mysqli->insert_id; }
return $this->_resultSQL;
}
public function __destruct(){
if($this->_mysqli){
$this->_mysqli->close();
}
}
}
y luego en el constructor de las clases usuario, particular y establecimiento hago
Código:
// incluyo la clase conexion, la defino y..
function public __construct(){
$this->_conexion = new Conexion();
}