Created
April 6, 2016 16:10
-
-
Save ricardosiri68/24917b24adc33b0bd652e428467ff901 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DataBase | |
{ | |
private $mysqli; | |
public function __construct() | |
{ | |
$this->mysqli = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD,DB_NAME); | |
if ($this->mysqli->connect_error) { | |
throw new Exception("Connection failed: " . $this->mysqli->connect_error); | |
} | |
} | |
public function delete($table,$where) | |
{ | |
$sql="DELETE FROM $table WHERE $where"; | |
if(!$result=$this->mysqli->query($sql)){ | |
throw new Exception("Problemas con la consulta".$this->mysqli->error); | |
} | |
} | |
//funcionp ara insertar en la base de datos local los valores de las rncs | |
public function insert2($table,$fields) | |
{ | |
$astring = implode("', '",$fields); | |
$astringTwo = "'".$astring."'"; | |
$sql="insert into $table VALUES (".$astringTwo.")"; | |
if(!$result=$this->mysqli->query($sql)){ | |
throw new Exception("Problemas con la consulta".$this->mysqli->error); | |
} | |
} | |
//busca la fecha del ultimo reporte | |
public function leernombres() | |
{ | |
$i=0; | |
$sql="SELECT * FROM `base1`"; | |
$resultado=$this->mysqli->query($sql); | |
while ($fila = $resultado->fetch_assoc()) { | |
$nms_siteinfo[] = $fila; | |
} | |
return $nms_siteinfo; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UsersModel extends Model | |
{ | |
public function PruebaConsulta($id) | |
{ | |
echo "Probando la Consulta"; | |
} | |
//calcular rac LAC | |
public function leernombres(){ | |
$data= $this->db->leernombres(); | |
return $data; | |
} | |
//inserta lo calculado en la RACLAC, local | |
// public function insertarRACLAC($data){ | |
// $this->db->insert2('rac_lac_sac',$data); | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment