Show sourcecode
The following files exists in this folder. Click to view.
webbsrvprg/webbsrvprg/exercises/PHPDB/ovn1/
createkompisar.php
delete_post_ovn1.php
insert_into_table_ovn1.php
insertintotable_default2.php
post_actions_ovn1.php
selectpost2.php
update_post_ovn1.php
createkompisar.php
40 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 kompisar (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
phone INT(15),
email VARCHAR(50) NOT NULL,
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_ovn1.php"><button class="link">
Post actions
</button></a>
</body>
</html>