friendsTable.", utilisateurs"; $condition = "WHERE ID_personne = ? AND amis.ID_amis = utilisateurs.ID ORDER BY utilisateurs.last_activity DESC"; $condValues = array($userID); //Specify which fields to get $fieldsList = array( "utilisateurs.last_activity", $this->friendsTable.".ID_amis", $this->friendsTable.".actif", $this->friendsTable.".abonnement", ); //Perform the request on the database $results = CS::get()->db->select($tableName, $condition, $condValues, $fieldsList); //Process results $friendsList = array(); foreach($results as $process){ $friendsList[] = array( "ID_friend" => $process["ID_amis"], "accepted" => $process["actif"], "following" => $process["abonnement"], "time_last_activity" => $process["last_activity"] ); } //Return result return $friendsList; } } //Register component Components::register("friends", new friends());