Show sourcecode
The following files exists in this folder. Click to view.
createTables.php
deleteActions.php
deletePlayers.php
index.js
index.php
javascript.js
jsonIndex.json
save.json
seePlayers.php
test.php
seePlayers.php
90 lines UTF-8 Windows (CRLF)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Delete</title>
</head>
<body>
<?php
include ('../dbconnection.php');
$message = null;
$id = null;
if (isset($_POST['id']) && !empty($_POST['id'])) {
$id = $_POST['id'];
try {
$sql = "SELECT * FROM actions where playerId=?";
$stmt = $dbconn->prepare($sql);
// fetch width column names, create a table
$data = array($id);
$stmt->execute($data);
$output = "<table><tr>
<td>ID</td>
<td>Starttid</td>
<td>Speltid</td>
</tr>";
while ($res = $stmt->fetch(PDO::FETCH_ASSOC)) {
$id = htmlentities($res['id']);
$timeStamp = htmlentities($res['timeStamp']);
$action = htmlentities($res['action']);
$direction = htmlentities($res['direction']);
$output .= "<tr>".
"<td>$id</td>".
"<td>$timeStamp</td>".
"<td>$action</td>".
"<td>$direction</td>".
"</tr>";
}
$output .= "</table>";
echo "$output";
}
catch(PDOException $e)
{
$message .= $sql . "<br>" . $e->getMessage();
}
} else {
$message .= "<br />";
}
echo $message;
// Ouput table with all posts
/*** The SQL SELECT statement ***/
$sql = "SELECT * FROM players";
$stmt = $dbconn->prepare($sql);
// fetch width column names, create a table
$data = array();
$stmt->execute($data);
$output = "<table><tr>
<td>ID</td>
<td>Starttid</td>
<td>Speltid</td>
</tr>";
while ($res = $stmt->fetch(PDO::FETCH_ASSOC)) {
$id = htmlentities($res['id']);
$start = htmlentities($res['startTime']);
$play = htmlentities($res['playTime']);
$output .= "<tr>".
"<td>$id</td>".
"<td>$start</td>".
"<td>$play</td>".
"<td><form method='post' action=''>".
"<input type='hidden' name='id' value='$id'>".
"<button type='submit'>Välj</button></form></td>".
"</tr>";
}
$output .= "</table>";
echo "$output";
$dbconn = null;
?>
</body>
</html>