Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "hioa";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Tilkobling til database feilet: " . $conn->connect_error);
- }
- mysqli_set_charset($conn,"utf8");
- $sql = " SELECT * FROM hioa.lol WHERE tureningsnummer = 3";
- $result = $conn->query($sql);
- echo "
- <div id='tableContainer-1'>
- <div id='tableContainer-2'>
- <table id='t01' align='center'> <tr>
- <th>Lagnavn</th>
- <th>Lagkaptein</th>
- <th>Spiller 2</th>
- <th>Spiller 3</th>
- <th>Spiller 4</th>
- <th>Spiller 5</th>
- <th>Kapteinens epost</th></tr>
- </div>"; // start a table tag in the HTML
- while($row = $result->fetch_assoc()) {
- echo
- "<tr><td>" . $row['lagnavn'] . "</td>" .
- "<td>" . $row['lagkaptein']. "</td>" .
- "<td>" .$row['spiller2'] ."</td>" .
- "<td>" . $row['spiller3'] ."</td>" .
- "<td>" . $row['spiller4'] ."</td>" .
- "<td>" . $row['spiller5'] ."</td>" .
- "<td>" . $row['email']."</td></tr>"; //$row['index'] the index here is a field name
- }
- echo "</table>"; //Close the table in HTML
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement