Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbsrvprg/exercises/sql-intro/sql-intro2/

admin.php
createtable.php
insertpost.php
login.php
skrivut.php
sql-intro2-index.php
tabort.php
uppdatera.php
welcome.php

createtable.php

34 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 users (
    id INT(3) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    förnamn VARCHAR(30) NOT NULL,
    efternamn VARCHAR(30) NOT NULL,
    användarnamn VARCHAR(30) NOT NULL,
    lösenord VARCHAR(30) NOT NULL,
    typ VARCHAR(10) NOT NULL
    )"
;

    
$dbconn->exec($sql);
    echo
"Tabell skapad";

  }
  catch(
PDOException $e){
    echo 
$sql"<br>"$e->getMessage();
  }

  
$dbconn null;
  
?>
</body>
</html>