You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Scripted/WEB/Controller/JoueurGateway.php

44 lines
1.1 KiB

<?php
require "../Model/Joueur.php";
require "Connection.php";
class JoueurGateway
{
private Connection $con;
/**
* @param Connection $con
*/
public function __construct(Connection $con){
$this->con = $con;
}
/**
* @param Connection $con
*/
public function setCon(Connection $con): void
{
$this->con = $con;
}
public function insert(Joueur $joueur) : void{
$query = "INSERT INTO Joueur VALUE (:email,:pseudo,:mdp)";
$this->con->executeQuery($query, array(
':email' => array($joueur->getEmail(),PDO::PARAM_STR),
':pseudo' => array($joueur->getPseudo(),PDO::PARAM_STR),
':mdp' => array($joueur->getMdp(),PDO::PARAM_STR)));
}
public function showAll() : void{
$query = "SELECT * FROM Joueur";
$this->con->executeQuery($query, array());
$results=$this->con->getResults();
foreach ($results as $row)
echo $row['email'] . '</br>';
echo $row['pseudo'] . '</br>';
echo $row['mdp'] . '</br>';
echo '</br>';
}
}