i have an error in my PHP code , undefined variable error while it's already defined before this is the first error :
( ! ) Notice: Undefined variable: utilisateurKore in C:\wamp64\www\myFiles\PHP\views\edit.php on line 16
this is the second error :
this the code wehere the error is :
<?PHP
include "../entities/utilisateur.php";
include "../core/utilisateurCore.php";
if (isset($_GET['pseudo'])){
$utilisateurKore = new utilisateurCore();
$result=$utilisateurKore->recupererUser($_GET['pseudo']);
foreach($result as $row){
$pseudo=$row['pseudo'];
$mail=$row['mail'];
$motdepasse=$row['motdepasse'];
}
}
if (isset($_POST['modifier'])){
$utilisateur1=new utilisateur($_POST['pseudo'],$_POST['mail'],$_POST['motdepasse']);
$utilisateurKore->modifierUser($utilisateur1,$_POST['pseudo']);
}
?>
this is the class of the variable :
<?php
include "../config.php";
class utilisateurCore{
//edition de profil
function modifierUser($utilisateur,$pseudo){
$sql="UPDATE membres SET motdepasse=:motdepasse,mail=:mail WHERE pseudo=:pseudo";
$db = config::getConnexion();
//$db->setAttribute(PDO::ATTR_EMULATE_PREPARES,false);
try{
$req=$db->prepare($sql);
$motdepasse=$utilisateur->getMotdepasse();
$mail=$utilisateur->getEmail();
// $datas = array(':cinn'=>$cinn, ':cin'=>$cin, ':nom'=>$nom,':prenom'=>$prenom,':nbH'=>$nb,':tarifH'=>$tarif);
$req->bindValue(':mail',$mail);
$req->bindValue(':motdepasse',$motdepasse);
$s=$req->execute();
// header('Location: index.php');
}
catch (Exception $e){
echo " Erreur ! ".$e->getMessage();
}
}
function recupererUser($pseudo){
$sql="SELECT * from employe where pseudo=$pseudo";
$db = config::getConnexion();
try{
$liste=$db->query($sql);
return $liste;
}
catch (Exception $e){
die('Erreur: '.$e->getMessage());
}
}
?>