Webbserverprogrammering 1

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

insertpost.php

26 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>Document</title>
</head>
<body>
  <?php
  
include ('../../../dbconnection.php');
  try {
    
$sql "INSERT INTO kompisar (förnamn, efternamn, mobil, epost)
    VALUES ('David', 'Nyberg', '0736793788', 'davidng@varmdogymnasium.se')"
;
    
$dbconn->exec($sql);

    echo
"Data skapad";
  }
  catch(
PDOException $e) {
    echo 
$sql "<br />" $e->getMessage();
  }
  
  
$dbconn null;
  
?>
</body>
</html>