Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static $db_host = 'localhost';
- private static $db_user = '';
- private static $db_pass = '';
- private $db_name = '';
- private $conexion;
- private $resultado;
- public function __construct()
- {
- $this->conectar();
- }
- protected function conectar()
- {
- $this->conexion = mysqli_connect(
- self::$db_host,
- self::$db_user,
- self::$db_pass,
- $this->db_name);
- if (!$this->conexion) {
- mysqli_error($this->conexion);
- } else {
- return true;
- }
- }
- protected function query($sql)
- {
- $this->resultado = mysqli_query($this->conexion, $sql);
- if (!$this->resultado) {
- die('error: query ' . mysql_error());
- }
- }
- protected function extraerRegistro()
- {
- $fila = mysqli_fetch_assoc($this->resultado);
- return $fila;
- }
- public function affected()
- {
- $num = mysqli_affected_rows($this->conexion);
- if ($num) {
- return true;
- } else {
- return false;
- }
- }
Add Comment
Please, Sign In to add comment