Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //MODELPROFESOR.PHP
- <?php
- include_once '../util/Conexion.php';
- class ModelProfesor
- {
- public function __construct()
- {
- $con = new Conexion();
- }
- public function ModelInsertarProfesor($id,$pat,$mat,$nom,$usu,$cla,$img){
- try{
- $obj = Conexion::singleton();
- $query = $obj->prepare('INSERT INTO n_profesor VALUES(?,?,?,?,?,?,?)');
- $query->bindParam(1, $id);
- $query->bindParam(2, $pat);
- $query->bindParam(3, $mat);
- $query->bindParam(4, $nom);
- $query->bindParam(5, $usu);
- $query->bindParam(6, $cla);
- $query->bindParam(7, $img);
- $query->execute();//Ejecuta la consulta SQL
- }catch(PDOException $e){
- $e->getMessage();
- }
- }
- public function ModelValidarProfesor($usu,$cla){
- try{
- $obj = Conexion::singleton();
- $query = $obj->prepare('SELECT * FROM n_profesor WHERE prof_identificador=? AND prof_password=?');
- $query->bindParam(1, $usu);
- $query->bindParam(2, $cla);
- $query->execute();//Ejecuta la consulta SQL
- $vector = $query->fetchAll();
- $query=null;
- return $vector;
- }catch(Exception $e){
- throw $e;
- }
- }
- public function ModelBuscarProfesor($paterno){
- try{
- $obj = Conexion::singleton();
- $query = $obj->prepare("SELECT * FROM n_profesor WHERE prof_paterno LIKE CONCAT(?,'%') LIMIT 10");
- $query->bindParam(1, $paterno);
- $query->execute();//Ejecuta la consulta SQL
- $vector = $query->fetchAll();
- $query=null;
- return $vector;
- }catch(Exception $e){
- throw $e;
- }
- }
- public function ModelModificarProfesor($id,$pat,$mat,$nom){
- try{
- $obj = Conexion::singleton();
- $query = $obj->prepare('UPDATE n_profesor SET prof_paterno=?, prof_materno=?,prof_nombres=? WHERE id_profesor=?');
- $query->bindParam(4, $id);
- $query->bindParam(1, $pat);
- $query->bindParam(2, $mat);
- $query->bindParam(3, $nom);
- $query->execute();//Ejecuta la consulta SQL
- }catch(PDOException $e){
- $e->getMessage();
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement