Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. <script>
  2. window.onload = function() {
  3. var a = false;
  4.  
  5. var collapse = "p"+ "<?php echo $collapse ?>";
  6. var collapse2 = "btn"+"<?php $collapse ?>";
  7.  
  8.  
  9.  
  10.  
  11. document.getElementById(collapse2).onclick = function (){
  12. if(a== false){
  13. document.getElementById(collapse).style.height = "auto";
  14. a =true;
  15. }else{
  16. document.getElementById(collapse).style.height = "0px";
  17. a =false;
  18. }
  19. }
  20. }
  21. </script>
  22.  
  23. <?php
  24.  
  25. if ($result = mysqli_query($con, "SELECT * FROM stellingen WHERE REGIOID=1;")) {
  26. $amountOfStellingen = 0;
  27. while ($amountOfStellingen < 4) {
  28. mysqli_data_seek($result, $amountOfStellingen);
  29. $row = mysqli_fetch_assoc($result);
  30. $collapse = $amountOfStellingen;
  31. $stellingid = $row["Stelling_ID"];
  32. echo '<div class="stelling-wrapper" id="btn' . $collapse . '">
  33. <img src="images/button.svg" alt="Show more..." class="btn" id="bton">
  34. <p class="stelling">';
  35. echo "<p>{$row["Stelling"]}</p>";
  36. echo '<div id="p' . $collapse . '">
  37. <table id="tabel" border=1px class="data">
  38. <tr>
  39. <th>Title</th>
  40. <th>Source</th>
  41. <th>Weight</th>
  42. <th>Date</th>
  43. </tr>
  44. </div>
  45. </div>';
  46. echo '<script type="text/javascript" src="script/collapse.js">';
  47. echo '</script>';
  48. $sql1 = "SELECT * FROM stelling WHERE stelling_iD=$stellingid;";
  49. $records1 = mysqli_query($con, $sql1);
  50. $recordscheck = mysqli_num_rows($records1);
  51.  
  52. if ($recordscheck > 0) {
  53. while ($stelling = mysqli_fetch_assoc($records1)) {
  54. echo "<tr>";
  55. echo "<td>" . $stelling['Title'] . "</td>";
  56. echo "<td>" . $stelling['Source'] . "</td>";
  57. echo "<td>" . $stelling['Wheight'] . "</td>";
  58. echo "<td>" . $stelling['Timer'] . "</td>";
  59. echo "</tr>";
  60. }
  61. }
  62. $amountOfStellingen += 1;
  63. echo '</table>';
  64.  
  65.  
  66. }
  67. }
  68.  
  69. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement