getInfos(); $this->hostName = $result["hostName"]; $this->dbName = $result["dbName"]; $this->userName = $result["userName"]; $this->password = $result["password"]; } /** * Connects to the database * @return: true, if the connection was without problem * false, if there was a problem */ public function connect() { if(!($con = mysql_connect($this->hostName, $this->userName, $this->password))) { $this->strError = mysql_errno()." : ".mysql_error(); return false; }elseif (!mysql_select_db($this->dbName, $con)){ $this->strError = mysql_errno()." : ".mysql_error(); return false; }else { return true; } } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// /** * Fournit la liste de toutes les animations effectuees au magasin donne * @param: $idMagasin */ public function getListAnimations($idMagasin) { if($this->connect()){ $query = "SELECT * FROM `animation` as a, `magasin` as m WHERE a.idLieu = m.idMagasin "; if ($idMagasin != 'all') { $idMagasin = mysql_real_escape_string($idMagasin); $query .= "AND a.idLieu = '$idMagasin'"; } $result = mysql_query($query) or die(mysql_error()); while($row=mysql_fetch_assoc($result)){ $tab[$i++] = $row; } return $tab; } } /** * Fournit la liste de tous les magasins */ public function getListMagasins(){ if($this->connect()){ $query = "SELECT * FROM `magasin` "; $result = mysql_query($query) or die(mysql_error()); while($row=mysql_fetch_assoc($result)){ $tab[$i++] = $row; } return $tab; } } /** * Enregistre une nouvelle animation * $mag: id du magasin * $titre: nom de l'animation * $description: description de l'animation * $date: date de l'animation */ public function saveAnima
ml>ml>ml>ml>