Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VERSTUREN.PHP
- <?php
- $servername = "localhost";
- $username = "mt13-c-groep2";
- $password = "evwqfT";
- $dbname = "dbmt13-c-groep2";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $score = $_POST['score'];
- $naam = $_POST['naam'];
- $sql = "INSERT INTO score (ID, naam, score)
- VALUES ('NULL', '$naam', '$score')";
- if ($conn->query($sql) === TRUE) {
- echo "New record created successfully";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- $conn->close();
- ?>
- <form action="versturen.php" method="post">
- <p>Score:<input type="text" name="score" required><br />
- Naam:<input type="text" name="naam" required><br /></p>
- <input type="submit" value="submit">
- </form><br>
- <div id="scoreboard">
- SCOREBOARD.HTML
- <?php
- $servername = "localhost";
- $username = "mt13-c-groep2";
- $password = "evwqfT";
- $dbname = "dbmt13-c-groep2";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $result = mysqli_query($conn,"SELECT * FROM score");
- echo "<table border='1'>
- <tr>
- <th>score</th>
- <th>naam</th>
- </tr>";
- while($row = mysqli_fetch_array($result))
- {
- echo "<tr>";
- echo "<td>" . $row['score'] . "</td>";
- echo "<td>" . $row['naam'] . "</td>";
- echo "</tr>";
- }
- echo "</table>";
- mysqli_close($conn);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement