This commit is contained in:
Dusk 2021-12-10 21:22:06 +01:00
parent 163bb62a04
commit 63b19062ea
3 changed files with 25 additions and 0 deletions

BIN
guestbook.db Normal file

Binary file not shown.

10
index.php Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="ca">
<head>
<meta charset="utf-8"/>
<title>Guestbook</title>
</head>
<body>
hola
</body>
</html>

15
persistence.php Normal file
View File

@ -0,0 +1,15 @@
<?php
createDB();
function createDB()
{
$db = new SQLite3('guestbook.db');
$db->exec("CREATE TABLE user
(id_user INTEGER PRIMARY KEY, username TEXT NOT NULL UNIQUE, password TEXT)");
$db->exec("CREATE TABLE message
(id_msg INTEGER PRIMARY KEY, id_user INT, content TEXT NOT NULL,
FOREIGN KEY (id_user) REFERENCES user (id_user))");
}