Sql_string = $query; if(!$StandBy) $this->Execute(); } public function Execute(){ $this->IsExecute = true; $this->Res = mysql_query($this->Sql_string); if(!$this->Res && $this->Secure){ newClass("erreur",4,$this->Sql_string,mysql_error()); } } public function GetRes(){ return $this->Res; } public function GetNbResults(){ $this->TestExecute(); return mysql_num_rows($this->Res); } public function FR(){ $this->TestExecute(); return mysql_fetch_row($this->Res); } public function FAs(){ $this->TestExecute(); return mysql_fetch_assoc($this->Res); } public function FA(){ $this->TestExecute(); return mysql_fetch_assoc($this->Res); } protected function TestExecute(){ if(!$this->IsExecute){ $this->Execute();} } public function SetW($W){ $this->W = $W; } public function SetT($T){ $this->T = $T; } public function SetO($O){ $this->O = $O; } public function SetL($L){ $this->L = $L; } public function SetG($G){ $this->G = $G; } public function SetObjet(&$Obj){ $this->Objet = $Obj; } public function BuildSelect(){ $Need_jointure = false; if(sizeof($this->T)>1){ $Need_jointure = true; } ///CLAUSE SELECT $this->Sql_string = 'SELECT '; if($Need_jointure){ $this->Sql_string.= $this->Objet->GetColName(); }else{ $this->Sql_string.= $this->Objet->GetColName(false); } //CLAUSE FROM $this->Sql_string.= " FROM "; if(sizeof($this->T)==0){ $this->Sql_string.= $this->Objet->GetTblName(); }else{ $this->Sql_string.= join(',',$this->T); } //CLAUSE WHERE if(sizeof($this->W)>0){ $this->Sql_string.= " WHERE 1 AND "; $this->Sql_string.= join(" AND ",$this->W); } //CLAUSE GROUP BY if(sizeof($this->G)>0){ $this->Sql_string.= " GROUP BY ".join(",",$this->G); } //CLAUSE ORDER BY if(sizeof($this->O)>0){ $this->Sql_string.= "ORDER BY "; foreach($this->O as $k=>$v){ $this->Sql_string.= $v[0]." ".$v[1]." "; } } //CLAUSE LIMITE if(sizeof($this->L)==2){ $this->Sql_string.= " LIMIT ".$this->L[0].",".$this->L[1]; } // echobr($this->Sql_string); $this->Execute(); return $this->GetRes(); } } ?>