query('SELECT `id` FROM `units` WHERE `'.$game.'`="1" AND `show`="1" ORDER BY `sort` ASC'); while($unit = $sql->get($units)) { $sql->query('SELECT `id` FROM `tarifs` WHERE `unit`="'.$unit['id'].'" AND `game`="'.$game.'" AND `show`="1" LIMIT 1'); if(!$sql->num()) continue; else{ $sel = $unit['id']; break; } } return 'SELECT `id`, `test` FROM `units` WHERE `id`="'.$sel.'" LIMIT 1'; } public static function units($game) { global $sql; $list = ''; $units = $sql->query('SELECT `id`, `name` FROM `units` WHERE `'.$game.'`="1" AND `show`="1" ORDER BY `sort` ASC'); while($unit = $sql->get($units)) { $sql->query('SELECT `id` FROM `tarifs` WHERE `unit`="'.$unit['id'].'" AND `game`="'.$game.'" AND `show`="1" LIMIT 1'); if($sql->num()) $list .= ''; } return $list; } public static function tarifs($game, $unit) { global $sql; $list = ''; $sql->query('SELECT `id`, `name` FROM `tarifs` WHERE `game`="'.$game.'" AND `unit`="'.$unit.'" AND `show`="1" ORDER BY `sort` ASC'); while($tarif = $sql->get()) $list .= ''; return $list; } } ?>