Diciembre 4 de 2007 ********************************************************************************** */ class MySQL { protected $conexion; protected $resultado; protected $total_consultas; function MySQL() //REALIZA LA CONEXION A LA BASE DE DATOS { include("config.php"); if(!isset($this->conexion)) { $this->conexion = (mysql_connect($Server,$User,$Passwd)) or die(mysql_error()); mysql_select_db($DataBase,$this->conexion) or die(mysql_error()); } } function consulta($consulta) //EJECUTA LAS CONSULTAS { $this->total_consultas++; $resultado = mysql_query($consulta); if(!$resultado) { echo 'MySQL Error: ' . mysql_error(); exit; } return $resultado; } function fetch_array($consulta) // TRAE EL ARREGLO CON RESULTADOS { return mysql_fetch_array($consulta); } function result($_pagi_result2) { return mysql_result($_pagi_result2,0,0); } function num_rows($consulta) // CUENTA EL NUMERO DE REGISTROS ENCONTRADOS { return mysql_num_rows($consulta); } function desconectar() // CIERRA LA CONECCION CON LA BASE DE DATOS { mysql_close($this->conexion); } function insert_id() // TRAE EL ULTIMO ID DEL ULTIMO INSERTEN LA BASE DE DATOS { return mysql_insert_id($this->conexion); } } ?>