Corrections

This commit is contained in:
Lucas Mascaro 2015-12-03 12:25:02 +01:00
parent 93276121fa
commit c681bf4f66
4 changed files with 20 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{ {
"host": "localhost", "host": "localhost",
"login": "php", "login": "login",
"password": "Qt358nUdyeTxLDM8", "password": "password",
"database": "projetphp" "database": "DBName"
} }

View File

@ -21,15 +21,17 @@ class PatientRepo
} }
public function add($civilite,$prenom,$nom,$adresse,$ville,$codePostal,$dateNaissance,$lieuNaissance,$numSecu,$medecinTraitant = null){ public function add($civilite,$prenom,$nom,$adresse,$adresse2,$ville,$codePostal,$dateNaissance,$lieuNaissance,$numSecu,$medecinTraitant = null){
$dateNaissance = date('o-m-d',$dateNaissance); $dateNaissance = strtotime($dateNaissance);
$dateNaissance = Date('o-m-d',$dateNaissance);
$req = $this->connexion->prepare('INSERT INTO Patient VALUES (:civilite,:nom,:prenom,:adresse,:ville,:codePostal,:dateNaissance,:lieuNaissance,:numSecu,DEFAULT,:medecin)'); $req = $this->connexion->prepare('INSERT INTO Patient VALUES (:civilite,:nom,:prenom,:adresse,:adresse2,:ville,:codePostal,:dateNaissance,:lieuNaissance,:numSecu,DEFAULT,:medecin)');
$result = $req->execute(['civilite' => $civilite, $result = $req->execute(['civilite' => $civilite,
'nom' => $nom, 'nom' => $nom,
'prenom' => $prenom, 'prenom' => $prenom,
'adresse' => $adresse, 'adresse' => $adresse,
'adresse2' => $adresse2,
'ville' => $ville, 'ville' => $ville,
'codePostal' => $codePostal, 'codePostal' => $codePostal,
'dateNaissance' => $dateNaissance, 'dateNaissance' => $dateNaissance,

View File

@ -22,6 +22,7 @@ class RDVRepo
} }
public function getByDate($date){ public function getByDate($date){
$date = strtotime($date);
$date = date('o-m-d',$date); $date = date('o-m-d',$date);
$req = $this->connexion->prepare('SELECT * FROM RDV WHERE DATE(FROM_UNIXTIME(1449136444)) = :date'); $req = $this->connexion->prepare('SELECT * FROM RDV WHERE DATE(FROM_UNIXTIME(1449136444)) = :date');
$req->execute(['date' => $date]); $req->execute(['date' => $date]);

View File

@ -6,16 +6,23 @@
* Time: 11:52 * Time: 11:52
*/ */
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
require_once('autoloader.php'); require_once('autoloader.php');
$jsonP = json_decode('Docs/PatientExemple.json',true); $jsonP = json_decode(file_get_contents('Docs/PatientExemple.json'),true);
$jsonM = json_decode('Docs/MedecinExemple.json',true); $jsonM = json_decode(file_get_contents('Docs/MedecinExemple.json'),true);
var_dump(StaticRepo::testConnexion());
$repo = new PatientRepo(); $repo = new PatientRepo();
$repoM = new MedecinRepo();
foreach($jsonM as $patient) { foreach($jsonM as $patient) {
$repo->add($patient['Civilite'], $patient['Prenom'], $patient['Nom']); $repoM->add($patient['Civilite'], $patient['Prenom'], $patient['Nom']);
} }
foreach($jsonP as $patient){ foreach($jsonP as $patient){
$repo->add($patient['Civilite'],$patient['Prenom'],$patient['Nom'],$patient['Adresse'],$patient['Ville'],$patient['CodePostal'],$patient['DateNaissance'],$patient['LieuNaissance'],$patient['NumSecuriteSociale'],$patient['MedecinTraitant']) $repo->add($patient['Civilite'],$patient['Prenom'],$patient['Nom'],$patient['Adresse'],NULL,$patient['Ville'],$patient['CodePostal'],$patient['DateNaissance'],$patient['LieuNaissance'],$patient['NumSecuriteSociale'],$patient['MedecinTraitant']);
} }