Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.19 KB | None | 0 0
  1. $query_resp = mysql_query("SELECT *
  2. FROM
  3. respostas
  4. WHERE
  5. resp_usuario='$id_usuario'
  6. AND resp_questionario='$quest'
  7. AND resp_area='$area'
  8. AND resp_subgrupo='$subgrupo'
  9. AND resp_loja='$loja'
  10. AND resp_pergunta_id='$idpergunta'")or die(mysql_error());
  11. while ($row = mysql_fetch_array($query_resp)) {
  12. $resposta = $row['resp_resposta'];
  13. $st = $row['resp_status'];
  14. }
  15. echo"<div class'form-group'>";
  16. echo"<div class='col-lg-10 col-lg-offset-2'>";
  17.  
  18. if ($status == "1") {
  19. echo"<center><h4>PERGUNTA JA RESPONDIDA | RESPOSTA:$resposta</h4></center>";
  20. } else {
  21. echo"<center><button type='submit' class='btn btn-danger'>REPONDER</button></center><br />";
  22. }
  23. echo"</div>";
  24. echo"</div>";
  25. var_dump($query_resp);
  26.  
  27. <?php
  28. ini_set('display_errors',true);
  29. error_reporting(E_ALL);
  30. ?>
  31.  
  32. <?php
  33. // A sessão precisa ser iniciada em cada página diferente
  34. if (!isset($_SESSION)) session_start();
  35. // Verifica se não há a variável da sessão que identifica o usuário
  36. if (!isset($_SESSION['usu_login'])) {
  37. // Destrói a sessão por segurança
  38. session_destroy();
  39. // Redireciona o visitante de volta pro login
  40. header("Location: logout.php"); exit;
  41. }
  42. ?>
  43. <?php
  44. require("conexao.php");
  45. ?>
  46. <html>
  47. <head>
  48. <meta charset="utf-8">
  49. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  50. <meta name="viewport" content="width=device-width, initial-scale=1">
  51. <title>CHECKLIST LOJAS</title>
  52. <link href="includes/bootstrap.min.css" rel="stylesheet">
  53. <link href="includes/css/bootstrap.min.css" rel="stylesheet">
  54. </head>
  55. <body>
  56. <?php
  57. // SESSIONS
  58. //$_SESSION['usu_nome'] = $nome;
  59. //$_SESSION['usu_senha'] = $senha;
  60. //$_SESSION['usu_setor'] = $nivel;
  61. // $login = $_SESSION['usu_login'];
  62. $id_usuario = $_SESSION['usu_id'];
  63. $loja = $_SESSION['usu_loja_id'];
  64. $quest = $_SESSION['quest'];
  65. ?>
  66. <?php
  67. $query_count = mysql_query("SELECT
  68. COUNT(rp.id) AS TOTAL_PERG
  69. FROM
  70. relacaoperg AS rp
  71. INNER JOIN perguntas AS p ON rp.id_pergunta = p.perg_id
  72. INNER JOIN area AS a ON rp.id_area = a.area_id
  73. INNER JOIN sub_area AS sb ON rp.id_subgrupo = sb.sub_area_cod
  74. WHERE
  75. a.area_id='1' AND sb.sub_area_cod='1'")or die(mysql_error());
  76. while ($row = mysql_fetch_array($query_count)) {
  77. $totalpergunta = $row["TOTAL_PERG"];
  78. }
  79. ?>
  80. <?php
  81. $pergunta=1;
  82. while( $pergunta <= $totalpergunta ){
  83. $query_pesquisa = mysql_query("SELECT
  84. rp.id AS ORDEM,
  85. a.area_id AS AREA,
  86. sb.sub_area_cod AS SUBGRUPO,
  87. sb.sub_area_nome AS DESC_SUBGRUPO,
  88. p.perg_id AS ID_PEGUNTA,
  89. p.perg_desc AS DESC_PERGUNTA,
  90. rp.foto AS FOTO
  91. FROM
  92. relacaoperg AS rp
  93. INNER JOIN perguntas AS p ON rp.id_pergunta = p.perg_id
  94. INNER JOIN area AS a ON rp.id_area = a.area_id
  95. INNER JOIN sub_area AS sb ON rp.id_subgrupo = sb.sub_area_cod
  96.  
  97. WHERE
  98. a.area_id='1' AND sb.sub_area_cod='1' AND rp.id='$pergunta' ")or die(mysql_error());
  99.  
  100. if (empty($query_pesquisa)) {
  101. echo "Nenhum registro encontrado.";
  102. }
  103. while ($row = mysql_fetch_array($query_pesquisa)) {
  104. $ordem = $row["ORDEM"];
  105. $area = $row["AREA"];
  106. $subgrupo = $row["SUBGRUPO"];
  107. $descsubgrupo = $row["DESC_SUBGRUPO"];
  108. $idpergunta = $row["ID_PEGUNTA"];
  109. $descpergunta = $row["DESC_PERGUNTA"];
  110. $foto = $row["FOTO"];
  111. }
  112. ?>
  113. <br>
  114. <div class="container">
  115. <div id="div1" style="width:80%; margin:5 auto;">
  116. <center><div class="panel panel-danger"><div class="panel-heading"><?php echo"$descsubgrupo";?></div></div></center>
  117. <div class="jumbotron">
  118.  
  119. <form class="form-horizontal" action="index.php" method="GET">
  120. <fieldset>
  121. <legend>Pergunta <?php echo"$ordem";?>/<?php echo"$totalpergunta";?></legend>
  122. <div class="form-group">
  123. <h3><label><?php echo"$descpergunta";?></label></h3>
  124. <div class="col-lg-10">
  125. <div class="radio">
  126. <label>
  127. <input type="radio" name="optionsRadios" id="optionsRadios1" value="5">
  128. OTIMO
  129. </label>
  130. </div>
  131. <div class="radio">
  132. <label>
  133. <input type="radio" name="optionsRadios" id="optionsRadios1" value="3">
  134. REGULAR
  135. </label>
  136. </div>
  137. <div class="radio">
  138. <label>
  139. <input type="radio" name="optionsRadios" id="optionsRadios1" value="1">
  140. RUIM
  141. </label>
  142. </div>
  143. <div class="radio">
  144. <label>
  145. <input type="radio" name="optionsRadios" id="optionsRadios2" value="0">
  146. NAO APLICADO
  147. </label>
  148. </div>
  149. </div>
  150.  
  151. <br />
  152. <?php
  153. $query_resp = mysql_query("SELECT *
  154. FROM
  155. respostas
  156. WHERE
  157. resp_usuario='$id_usuario'
  158. AND resp_questionario='$quest'
  159. AND resp_area='$area'
  160. AND resp_subgrupo='$subgrupo'
  161. AND resp_loja='$loja'
  162. AND resp_pergunta_id='$idpergunta'")or die(mysql_error());
  163. while ($row = mysql_fetch_array($query_resp)) {
  164. $resposta = $row['resp_resposta'];
  165. $st = $row['resp_status'];
  166. }
  167. echo"<div class'form-group'>";
  168. echo"<div class='col-lg-10 col-lg-offset-2'>";
  169. $status=$st;
  170. if ($status == "1") {
  171. echo"<center><h4>PERGUNTA JA RESPONDIDA | RESPOSTA:$resposta</h4></center>";
  172. } else {
  173. echo"<center><button type='submit' class='btn btn-danger'>REPONDER</button></center><br />";
  174. }
  175. echo"</div>";
  176. echo"</div>";
  177. var_dump($query_resp);
  178.  
  179. ?>
  180. </fieldset>
  181.  
  182. </form>
  183. </div>
  184. </div>
  185. </div>
  186.  
  187.  
  188. </body>
  189. </html>
  190. <?php $pergunta++; } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement