Guest User

Untitled

a guest
Jan 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. require_once 'conexion.php';
  4. $obj = json_decode(file_get_contents("php://input"));
  5.  
  6. $stmt = $db->prepare("INSERT INTO usuario (id_rol, nombre, apellidoP,apellidoM, correo, pass, campus) VALUES ( ?, ?, ?, ?, ?,?,?)");
  7.  
  8. $stmt->bind_param('issssss', $obj->id_rol, $obj->nombre, $obj->apellidoP, $obj->apellidoM, $obj->correo, $obj->pass,$obj->campus);
  9.  
  10. $stmt->execute();
  11.  
  12. $idGenerado = $stmt->insert_id;
  13.  
  14.  
  15. if($obj->id_rol==3){
  16.  
  17. $stmt = $db->prepare("SELECT id_actividad FROM actividad");
  18.  
  19. $stmt->bind_result($id_actividad);
  20.  
  21. $stmt->execute();
  22.  
  23.  
  24. while ($stmt->fetch()) {
  25.  
  26. echo $id_actividad." ".$idGenerado."n";
  27.  
  28. $evaluador = 27;
  29.  
  30. $puntuacion1=0;
  31.  
  32. $puntuacion2=0;
  33.  
  34. $observacion ="0";
  35.  
  36. $stmt2 = $db->prepare("INSERT INTO puntuacion ( id_actividad, id_usuario_docente, id_usuario_evaluador, puntuacion_obtenida, puntuacion_evaluada, observacion, fecha)
  37. VALUES ( ?,?,?,?,?,?,now())");
  38.  
  39. $stmt2->bind_param('siiiiss', $id_actividad, $idGenerado, $evaluador, $puntuacion1, $puntuacion2, $observacion);
  40.  
  41. $stmt2->execute();
  42.  
  43.  
  44. $stmt2->close();
  45. }
  46.  
  47. $stmt->close();
  48. }
  49. echo "registro almacenado"
  50.  
  51. ? >
Add Comment
Please, Sign In to add comment