Advertisement
xlujiax

Untitled

Dec 3rd, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. //MODELPROFESOR.PHP
  2. <?php
  3. include_once '../util/Conexion.php';
  4. class ModelProfesor
  5. {
  6. public function __construct()
  7. {
  8. $con = new Conexion();
  9. }
  10.  
  11. public function ModelInsertarProfesor($id,$pat,$mat,$nom,$usu,$cla,$img){
  12. try{
  13. $obj = Conexion::singleton();
  14. $query = $obj->prepare('INSERT INTO n_profesor VALUES(?,?,?,?,?,?,?)');
  15.  
  16. $query->bindParam(1, $id);
  17. $query->bindParam(2, $pat);
  18. $query->bindParam(3, $mat);
  19. $query->bindParam(4, $nom);
  20. $query->bindParam(5, $usu);
  21. $query->bindParam(6, $cla);
  22. $query->bindParam(7, $img);
  23.  
  24. $query->execute();//Ejecuta la consulta SQL
  25. }catch(PDOException $e){
  26. $e->getMessage();
  27. }
  28. }
  29. public function ModelValidarProfesor($usu,$cla){
  30. try{
  31. $obj = Conexion::singleton();
  32. $query = $obj->prepare('SELECT * FROM n_profesor WHERE prof_identificador=? AND prof_password=?');
  33.  
  34. $query->bindParam(1, $usu);
  35. $query->bindParam(2, $cla);
  36.  
  37. $query->execute();//Ejecuta la consulta SQL
  38. $vector = $query->fetchAll();
  39. $query=null;
  40. return $vector;
  41. }catch(Exception $e){
  42. throw $e;
  43. }
  44. }
  45. public function ModelBuscarProfesor($paterno){
  46. try{
  47. $obj = Conexion::singleton();
  48. $query = $obj->prepare("SELECT * FROM n_profesor WHERE prof_paterno LIKE CONCAT(?,'%') LIMIT 10");
  49.  
  50. $query->bindParam(1, $paterno);
  51.  
  52. $query->execute();//Ejecuta la consulta SQL
  53. $vector = $query->fetchAll();
  54. $query=null;
  55. return $vector;
  56. }catch(Exception $e){
  57. throw $e;
  58. }
  59. }
  60. public function ModelModificarProfesor($id,$pat,$mat,$nom){
  61. try{
  62. $obj = Conexion::singleton();
  63. $query = $obj->prepare('UPDATE n_profesor SET prof_paterno=?, prof_materno=?,prof_nombres=? WHERE id_profesor=?');
  64.  
  65. $query->bindParam(4, $id);
  66. $query->bindParam(1, $pat);
  67. $query->bindParam(2, $mat);
  68. $query->bindParam(3, $nom);
  69.  
  70. $query->execute();//Ejecuta la consulta SQL
  71. }catch(PDOException $e){
  72. $e->getMessage();
  73. }
  74. }
  75.  
  76. }
  77. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement