Show sourcecode
The following files exists in this folder. Click to view.
webbsrvprg/exercises/sql-intro/sql-intro1/
createtable.php
insertpost.php
skrivut.php
sql-intro1-index.php
tabort.php
uppdatera.php
createtable.php
33 lines UTF-8 Windows (CRLF)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create</title>
</head>
<body>
<?php
include ('../../../dbconnection.php');
try {
$sql = "CREATE TABLE kompisar (
id INT(3) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
förnamn VARCHAR(30) NOT NULL,
efternamn VARCHAR(30) NOT NULL,
mobil INT(10) NOT NULL,
epost VARCHAR(50) NOT NULL
)";
$dbconn->exec($sql);
echo"Tabell skapad";
}
catch(PDOException $e){
echo $sql. "<br>". $e->getMessage();
}
$dbconn = null;
?>
</body>
</html>