Advertisement
Guest User

Untitled

a guest
Feb 25th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. $servername = "localhost";
  5. $username = "root";
  6. $password = "";
  7. $dbname = "hioa";
  8.  
  9. $conn = new mysqli($servername, $username, $password, $dbname);
  10.  
  11. if ($conn->connect_error) {
  12.     die("Tilkobling til database feilet: " . $conn->connect_error);
  13. }
  14. mysqli_set_charset($conn,"utf8");
  15.  
  16.  
  17. $sql = " SELECT * FROM hioa.lol WHERE tureningsnummer = 3";
  18. $result = $conn->query($sql);
  19.  
  20. echo "
  21. <div id='tableContainer-1'>
  22.  <div id='tableContainer-2'>
  23. <table id='t01' align='center'> <tr>
  24. <th>Lagnavn</th>
  25. <th>Lagkaptein</th>
  26. <th>Spiller 2</th>
  27. <th>Spiller 3</th>
  28. <th>Spiller 4</th>
  29. <th>Spiller 5</th>
  30. <th>Kapteinens epost</th></tr>
  31. </div>"; // start a table tag in the HTML
  32.  
  33. while($row = $result->fetch_assoc()) {
  34.     echo
  35.         "<tr><td>" . $row['lagnavn'] . "</td>" .
  36.         "<td>" . $row['lagkaptein']. "</td>" .
  37.         "<td>" .$row['spiller2'] ."</td>" .
  38.         "<td>" . $row['spiller3'] ."</td>" .
  39.         "<td>" . $row['spiller4'] ."</td>" .
  40.         "<td>" . $row['spiller5'] ."</td>" .
  41.         "<td>" . $row['email']."</td></tr>";  //$row['index'] the index here is a field name
  42.  
  43. }
  44.  
  45. echo "</table>"; //Close the table in HTML
  46.  
  47. $conn->close();
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement