Show sourcecode
The following files exists in this folder. Click to view.
webbserverprogrammering/projekt/GYA-Teo-Kit/php/
createTables.php
dbconnection.php
index.php
main.php
map_maker.html
seePlayers.php
createTables.php
56 lines ASCII Windows (CRLF)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Create</title>
</head>
<body>
<?php
/** @var PDO $dbconn */
include ('dbconnection.php');
try {
// sql to create table
$sql = "CREATE TABLE players (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
startTime VARCHAR(32),
playTime INT(16)
)";
// use exec() because no results are returned
$dbconn->exec($sql);
echo "Table created successfully";
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
echo "<br> <br>";
try {
// sql to create table
$sql = "CREATE TABLE actions (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
timeStamp INT(16),
action VARCHAR(10),
direction VARCHAR(7),
playerId INT(10)
)";
// use exec() because no results are returned
$dbconn->exec($sql);
echo "Table created successfully";
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
//Rensa kopplingen till databasen
$dbconn = null;
?>
</body>
</html>