Ich würde gerne in einer Tabelle in der letzten Spalte einen Button machen mit dem man einen Eintrag aus der Datenbank als erledigt markieren kann. Leider bin ich momentan zu dumm dazu es hin zu bekommen. Wie kann ich dies realisieren?
Momentan sieht die Seite ca. so aus.
Und hier der Code dazu.
Momentan sieht die Seite ca. so aus.
| ID | Skype | Art | Kommentar | Datum | IP | Spende | erledigt? | ✔ |
| 1 | bla | bla | bla | 2017-04-25 10:51:33 | 0.0.0.0 | nein | nein | ✔ |
Und hier der Code dazu.
PHP-Code:
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<body>
<style>
table, th, td {
border: 1px solid black;
}
</style>
<?php
header("Content-Type: text/html; charset=utf-8");
$servername = "localhost";
$username = "******";
$password = "*******";
$dbname = "******";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT ID, Skype, Art, Kommentar, Datum, ipadress, PSC, erledigt FROM designs";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table><tr><th>ID</th><th>Skype</th><th>Art</th><th>Kommentar</th><th>Datum</th><th>IP</th><th>Spende</th><th>erledigt</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["ID"]. "</td><td>" . $row["Skype"]. "</td><td>" . $row["Art"]. "</td><td>" . $row["Kommentar"]. "</td><td>" . $row["Datum"]. "</td><td>" . $row["ipadress"]. "</td><td>" . $row["PSC"]. "</td><td>" . $row["erledigt"]. "</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
</body>
</html>

Kommentar