1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| class myLangue {
private $id_Compte;
private $id_Client;
// fonctions d'initialisation
public function __construct($ets,$nui) {
$this->id_Compte = $ets;
$this->id_Client = $nui;
}
// fonction d'enregistrement de la langue
public function saveLangue($langue) {
$query = "update clients";
$query.= " set langue = '$langue'";
$query.= " where id_compte = '".$this->id_Compte."'";
$query.= " and id_client = ".$this->id_Client;
execute_query($query); //Fonction permettant d'exécuter une requete
}
// fonction donne la langue
public function getLangue() {
$tabLng = array();
$query = "select ifNull(langue,'FR') as langue";
$query.= " from clients";
$query.= " where id_compte = '".$this->id_Compte."'";
$query.= " and id_client = ".$this->id_Client;
$query.= " limit 1";
$tabLng= select_query($query); // fonction permettant d'executer la requete et de récupérer une tableau associatif comme résultat
if (count($tabLng)==0) {
return 'FR';
} else {
return $tabLng[0]['langue'];
}
}
} |
Partager