Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.65 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \
  2.         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
  3. <html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"pl-PL\">
  4. <head>
  5.     <meta http-equiv="content-type" content="text/html; charset=utf-8">
  6.     <title>Rezultat zapytania</title>
  7.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
  8.           integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  9.  
  10.  
  11. </head>
  12. <body>
  13.  
  14. <?php
  15. ini_set("display_errors", 0);
  16. require_once 'dbconnect.php';
  17. $polaczenie = mysqli_connect($host, $user, $password);
  18. mysqli_query($polaczenie, "SET CHARSET utf8");
  19. mysqli_query($polaczenie, "SET NAMES 'utf8' COLLATE 'utf8_polish_ci'");
  20. mysqli_select_db($polaczenie, $database);
  21. $zapytanietxt = file_get_contents("zapytanie.sql");
  22. $rezultat     = mysqli_query($polaczenie, $zapytanietxt);
  23. $ile          = mysqli_num_rows($rezultat);
  24.  
  25. //var_dump($zapytanietxt);
  26.  
  27. if ($ile >= 1) {
  28.     echo <<<END
  29. <div class="container col-9">
  30. <div class="row">
  31.  <table class="table table-striped table-dark">
  32.   <thead>
  33.     <tr>
  34.       <th scope="col">#ID</th>
  35.       <th scope="col">Słówko po polsku</th>
  36.       <th scope="col">Słówko po angielsku</th>
  37.       <th scope="col">Wymowa</th>
  38.       <th scope="col">Kategoria</th>
  39.     </tr>
  40.   </thead>
  41. <tbody>
  42. END;
  43. }
  44. for ($i = 1; $i <= $ile; $i++) {
  45.     $row           = mysqli_fetch_assoc($rezultat);
  46.     $id            = $row['id'];
  47.     $slowko        = $row['slowko'];
  48.     $word          = $row['word'];
  49.     $wymowa        = $row['wymowa'];
  50.     $category_name = $row['category_name'];
  51.     //$category_id = $row['category_id'];
  52.  
  53.     echo <<<END
  54.  
  55.  
  56.     <tr>
  57.       <td scope="row">$id</td>
  58.       <td class="col-3">$slowko</td>
  59.       <td class="col-3">$word</td>
  60.       <td class="col-2">$wymowa</td>
  61.       <td class="col-3">$category_name</td>
  62.     </tr>  
  63.  
  64. END;
  65. }
  66.  
  67. ?>
  68. </tbody>
  69. </table>
  70. </div>
  71. </div>
  72. <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
  73.         integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
  74.         crossorigin="anonymous"></script>
  75. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
  76.         integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
  77.         crossorigin="anonymous"></script>
  78. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
  79.         integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
  80.         crossorigin="anonymous"></script>
  81.  
  82. </body>
  83. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement