Show sourcecode
The following files exists in this folder. Click to view.
webbsrvprg/webbsrvprg/exercises/PHPDB/ovn0/
createtable.php
delete_post.php
insertintotable.php
insertintotable_default.php
selectpost.php
update_post.php
createtable.php
39 lines ASCII Windows (CRLF)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Create</title>
</head>
<body>
<?php
include ('../dbconnect.php');
try {
// sql to create table
$sql = "CREATE TABLE pdodemotable (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
age INT(3),
reg_date DATETIME
)";
// 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;
?>
<a href="../Post_actions.php"><button class="link">
Post actions
</button></a>
</body>
</html>