$e_schuhe = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schuhe' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc");
$e_schuhe = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.rassen_type=".$char_1['rasse_a']['type']." OR i.rassen_type is NULL) AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schuhe' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc");
$e_schwert = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schwert' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc");
$e_schwert = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.rassen_type=".$char_1['rasse_a']['type']." OR i.rassen_type is NULL) AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schwert' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc");
$e_rustung = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Ruestung' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc");
$e_rustung = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.rassen_type=".$char_1['rasse_a']['type']." OR i.rassen_type is NULL) AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Ruestung' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc");
$e_schild = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schild' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc");
$e_schild = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.rassen_type=".$char_1['rasse_a']['type']." OR i.rassen_type is NULL) AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schild' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc");
$e_helm = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Helm' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc");
$e_helm = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.rassen_type=".$char_1['rasse_a']['type']." OR i.rassen_type is NULL) AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Helm' AND i.level <='$char_1[level]' AND 0 = (SELECT count(c.id) from chars c WHERE c.besitzer = w.user AND c.id != '$char_1[id]' AND find_in_set(w.id, kampf_item)) group by i.name order by i.level desc");
$clans_spend = db_query('SELECT spende, nickname, user.id as userid FROM user left join user_clan on user.id = user_clan.userid and user.clan = user_clan.clanid WHERE user.clan = '.$user_ida['clan'].' ORDER BY spende DESC');
$clans_spend = db_query('SELECT spende, nickname, user.id as userid, spende_today, spende_yesterday FROM user left join user_clan on user.id = user_clan.userid and user.clan = user_clan.clanid WHERE user.clan = '.$user_ida['clan'].' ORDER BY spende DESC');
$member = mysqli_num_rows($clans_spend);
$member = mysqli_num_rows($clans_spend);
$sql = 'select besitzer, round(sum(1/(1+exp(3-level/12)) * nutzung)) as nutzkosten from user inner join chars on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id where user.clan = clan_ware.clan and user.clan = '.$user_ida['clan'].' group by besitzer order by besitzer';
$sql = 'select besitzer, round(sum(1/(1+exp(3-level/12)) * nutzung)) as nutzkosten from user inner join chars on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id where user.clan = clan_ware.clan and user.clan = '.$user_ida['clan'].' group by besitzer order by besitzer';
$sql = 'SELECT sum(spende) as summe FROM user_clan WHERE clanid ='.$user_ida['clan'];
$sql = 'SELECT sum(spende) as summe, sum(spende_today) as spende_today, sum(spende_yesterday) as spende_yesterday FROM user_clan WHERE clanid ='.$user_ida['clan'];