Guest User

Untitled

a guest
Dec 11th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. <div class="form-group">
  2. <label for="fechaInicio">Fecha de la cita:</label>
  3. <div class="input-group date fecha">
  4. <input type="text" name="fechaInicio" class="form-control" id="fechaInicio" ng-model="cita.fechaInicio"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
  5. </div>
  6.  
  7. $scope.getHoras = function(){
  8. var fechaInicio = fechaInicio;
  9. $http.get('../api/horas.php'),{'fechaInicio':fechaInicio}.then(function(response){
  10. $scope.citas = response.data;
  11. });
  12. };
  13.  
  14. <?php
  15. $data = json_decode(file_get_contents("php://input"));
  16. @session_start();
  17. $id = $_SESSION["user_id"];
  18. $servername = "localhost";
  19. $username = "root";
  20. $password = "root";
  21. $dbname = "pruebas";
  22. $conn = new mysqli($servername, $username, $password, $dbname);
  23. /*$sql = "SELECT hora FROM horas where $fecha and horaCompleta = '1'"*/
  24. $sql = "SELECT hora FROM citas WHERE horaCompleta = 0 AND 'fechaInicio = $date-> fechaInicio' ";
  25. $result = $conn->query($sql);
  26. if ($result->num_rows > 0) {
  27. // output data of each row
  28. $data = array() ;
  29. while($row = $result->fetch_assoc()) {
  30. $data[] = $row;
  31.  
  32. }
  33. } else {
  34. echo "0 results";
  35. }
  36. echo json_encode($data);
  37. $conn->close();
  38. ?>
  39.  
  40. <div class="form-group">
  41. <label for="hora" ng-init="getHoras()">Hora:</label>
  42. <select ng-model="cita.hora">
  43.  
  44. <option
  45. value="{{cita.hora}}"
  46. ng-repeat="cita in citas">
  47. {{cita.hora}}
  48. </option>
  49. </select>
  50.  
  51. $scope.getHoras = function(){
  52. var fechaInicio = fechaInicio;
  53. $http.get('../api/horas.php'),{'fechaInicio':fechaInicio}.then(function(response){
  54. $scope.citas = response.data;
  55. });
  56. };
  57.  
  58. $scope.getHoras = function(){
  59. var fechaInicio = $scope.fechaInicio;
  60. //o vm.fechaInicio, según tengas referenciada el view model
  61. $http.get('../api/horas.php'),{'fechaInicio':fechaInicio}.then(function(response){
  62. $scope.citas = response.data;
  63. });
  64. };
Add Comment
Please, Sign In to add comment