ond
Veteran OT User
I need help to fix my php script! I have fixed a menu-list so you can choose between each city. So if I pick thais, then it should only load Houses from thais on the website, and if I pick carlin, then show only carlin houses, etc etc but now I'm stuck!
Here is my script & Screenshot!
Would be REALLY glad if someone could help me with this! Thanks for now!
Here is my script & Screenshot!
PHP:
<?php
/*
Copyright (C) 2007 - 2009 Nicaw
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
include ("include.inc.php");
$ptitle="Highscores - $cfg[server_name]";
include ("header.inc.php");
$SQL = AAC::$SQL;
?>
<div id="content">
<div class="top">Highscores</div>
<div class="mid">
<select name="sort" onchange="self.location.href=this.value">
<?php
if (empty($_GET['sort'])) $_GET['sort'] = 'thais';
$options = array_merge(array('thais', 'carlin'), $cfg['town_names']);
foreach ($options as $town) {
if ($town == $_GET['sort'])
$selected = ' selected="selected"';
else
$selected = '';
echo '<option value="haws.php?sort='.$town.'"'.$selected.'>'.ucfirst($town).'</option>';
}
echo '</select>';
?>
<table>
<tr class="color0"><td width="35%"><b>House</b></td><td width="25%"><b>Location</b></td><td width="25%"><b>Owner</b></td><td><b>Size</b></td><td><b>Rent</b></td></tr>
<?php
$HousesXML = simplexml_load_file($cfg['dirdata'].$cfg['house_file']);
$MySQL = AAC::$SQL;
$MySQL->myQuery('SELECT `players`.`name`, `houses`.`id` FROM `players`, `houses` WHERE `houses`.`owner` = `players`.`id`;');
while ($row = $MySQL->fetch_array()){
$houses[(int)$row['id']] = $row['name'];
}
foreach ($HousesXML->house as $house){
$i++;
$list.= '<tr '.getStyle($i).'><td>'.htmlspecialchars($house['name']).'</td><td>'.htmlspecialchars($cfg['temple'][(int)$house['townid']]['name']).'</td><td>'.$houses[(int)$house['houseid']].'</td><td>'.$house['size'].'</td><td>'.$house['rent'].'</td></tr>'."\r\n";
}
echo $list;
?>
</table>
</div>
<div class="bot"></div>
</div>
<?php include('footer.inc.php');?>
Would be REALLY glad if someone could help me with this! Thanks for now!