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
insertpost.php
30 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 users (förnamn, efternamn, användarnamn, lösenord, typ)
VALUES ('David', 'Nyberg', 'Honk', 'lösenord123', 'admin')";
$dbconn->exec($sql);
$sql = "INSERT INTO users (förnamn, efternamn, användarnamn, lösenord, typ)
VALUES ('Noah', 'Ekerot', 'Noahet', '123', 'vanlig')";
$dbconn->exec($sql);
echo"Data skapad";
}
catch(PDOException $e) {
echo $sql . "<br />" . $e->getMessage();
}
$dbconn = null;
?>
</body>
</html>