Guest User

Untitled

a guest
Sep 8th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. <?php
  2. include_once 'ajudante.php';
  3.  
  4. $host = 'mysql02.edgelifesports.hospedagemdesites.ws';
  5. $user = 'edgelifesports1';
  6. $pass = 's60riS3l1t38';
  7. $db = 'edgelifesports1';
  8. //Conecta banco de dados
  9. $link = mysql_conecta($host, $user, $pass, $db);
  10.  
  11. //retorna select tipo aulas
  12. $return = buscaTipoAulas();
  13.  
  14. $return_salas = buscaSalas();
  15.  
  16. //montar array horarios
  17. $horarios = array( '1' => 'MANHÃ', '2' => 'ALMOÇO', '3' => 'TARDE', '4' => 'NOITE' );
  18.  
  19. //montar array atividades
  20.  
  21.  
  22. //montar array salas
  23. for ($x = 0, $y = 1; $x < count($return_salas); $x++, $y++ ){
  24. $salas[$y] = $return_salas[$x][0];
  25. }
  26.  
  27. if(isset($_POST['aula']) && isset($_POST['horario'])){
  28.  
  29. $busca_ret = buscaGeral($_POST['aula'], $_POST['horario']);
  30.  
  31. //montar array perfeito
  32. for( $x = 0; $x < count($busca_ret); $x++ ) {
  33. $final[$x][0] = $busca_ret[$x][0]. '<br>';
  34. $final[$x][1] = $busca_ret[$x][1]. '<br>';
  35. $final[$x][2] = $busca_ret[$x][2]. '<br>';
  36. $final[$x][3] = $busca_ret[$x][3]. '<br>';
  37. }
  38.  
  39. //substitui for com valores reais
  40. for( $v = 0; $v < count($busca_ret); $v++ ) {
  41.  
  42. $final_real[$v][0] = dias($final[$v][0]); //DIA ID
  43. $final_real[$v][1] = horarioId($final[$v][1]); //horario ID
  44.  
  45. $final_real[$v][2] = atividades($final[$v][2]); //atividade ID
  46.  
  47. $final_real[$v][3] = salas($final[$v][3]); //sala ID
  48.  
  49. }
  50.  
  51. }
  52.  
  53.  
  54. ?>
  55.  
  56. Gostaria de procurar aulas de:
  57. <form method="post" action="horarios.php" name="form_horarios" id="">
  58.  
  59. <select name="aula" value="">
  60.  
  61. <?php
  62. $vv = 1;
  63. $xx = 2;
  64. foreach($return as $key => $value) {
  65. if(!$vv == 0){
  66. ?>
  67. <option value="<?php echo $vv; ?>"><?php echo $value[0]; ?></option>
  68. <?php
  69. }
  70. $vv++;
  71. }
  72. ?>
  73. </select>
  74.  
  75. no periodo:
  76. <select name="horario" value="" >
  77. <option value="15">Manha</option>
  78. <option value="23">Almoco</option>
  79. <option value="31">Tarde</option>
  80. <option value="46">Noite</option>
  81. </select>
  82.  
  83.  
  84. <input type="submit"></button>
  85. </form>
  86.  
  87.  
  88.  
  89.  
  90. <?php
  91.  
  92.  
  93. for( $v = 0; $v < count($final_real); $v++ ) {
  94.  
  95. echo "Dia : " .$final_real[$v][0].'<br>';
  96. echo "Horario : " .$final_real[$v][1].'<br>';
  97. echo "Atividade : " .$final_real[$v][2].'<br>';
  98. echo "Sala : " .$final_real[$v][3].'<br>';
  99.  
  100. echo '<br>';
  101.  
  102. }
  103.  
  104.  
  105.  
  106. mysql_close($link);
  107. ?>
Add Comment
Please, Sign In to add comment