Skip to content
Snippets Groups Projects
Commit 05948329 authored by DEGBEY SCOTT's avatar DEGBEY SCOTT
Browse files

Replace Database.php

parent 410e4398
Branches
No related merge requests found
......@@ -33,6 +33,22 @@ class Database
public function getGames()
{
// Charger ici les jeux de la base de données trois par trois
$id_tmp=1;
$statement = $this->pdo->prepare('SELECT * FROM game WHERE id = :id_tmp');
$statement->bindValue(':id', $id_tmp, PDO::PARAM_INT);
$id_tmp=$id_tmp+1;
$statement = $this->pdo->prepare('SELECT * FROM game WHERE id = :id_tmp');
$statement->bindValue(':id', $id_tmp, PDO::PARAM_INT);
$id_tmp=$id_tmp+1;
$statement = $this->pdo->prepare('SELECT * FROM game WHERE id = :id_tmp');
$statement->bindValue(':id', $id_tmp, PDO::PARAM_INT);
$statement->execute();
return $statement->fetch();
}
/**
......@@ -44,13 +60,14 @@ class Database
$statement = $this->pdo->prepare('SELECT * FROM game WHERE id = :id');
$statement->bindValue(':id', $id, PDO::PARAM_INT);
$statement->execute();
return $statement->fetch();
}
public function getGameTableSize()
{
// Retourner le nombre de jeux dans la base de données
$statement = $this->pdo->prepare('SELECT COUNT(*) FROM game');
return $statement->execute();
}
/**
......@@ -61,6 +78,10 @@ class Database
public function register($username, $password)
{
// Faire une fonction pour enregistrer un utilisateur dans la base de données.
$statement=$this->pdo->prepare('INSERT INTO user(password, username) VALUES(:password, :username)');
$statement->bindValue(':password', htmlspecialchars($password), PDO::PARAM_STR);
$statement->bindValue(':username', htmlspecialchars($username), PDO::PARAM_STR);
return $statement->execute();
}
public function login($username, $password)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment