Thanks!
<?php
// let start including the header of xoops
include("../../mainfile.php"); // including top functions of xoops
include(XOOPS_ROOT_PATH."/header.php"); // including the rest ?>
<?php include "conf.php"; ?>
<center>
<table width="100%">
<tr><th><a class="title" href="?sort=name">Name</a></th>
<th><a class="title" href="?sort=race">Race</a></th>
<th><a class="title" href="?sort=class">Class</a></th>
<th><a class="title" href="?sort=level">Level</a></th>
<th><a class="title" href="?sort=guild_rank">Rank</a></th>
</tr>
<?php
$link = mysql_connect($db_host, $db_user, $db_passwd) or die("Could not connect");
mysql_select_db($db_name) or die("Could not select DB");
$query = "SELECT * FROM `guild_char`";
if( $guild_name != "" ){
$query .= " WHERE guild_name = '$guild_name'";
}
if( $_REQUEST['sort'] == 'name' ) {
$query .= " ORDER BY name";
} else if( $_REQUEST['sort'] == 'race' ) {
$query .= " ORDER BY race";
} else if( $_REQUEST['sort'] == 'class' ) {
$query .= " ORDER BY class";
} else if( $_REQUEST['sort'] == 'guild_rank' ) {
$query .= " ORDER BY guild_rank";
} else {
$query .= " ORDER BY level DESC";
}
print "<!-- $query -->";
$result = mysql_query($query) or die(mysql_error());
while ( $row = mysql_fetch_assoc( $result ) )
{
?>
<tr>
<td><a class="charlink"
href="char.php?name=<?php print $row['name']; ?>&server=<?php print $row['server']; ?>">
<?php print $row["name"]; ?></a></td>
<td><?php print $row["race"]; ?></td>
<td><?php print $row["class"]; ?></td>
<td><?php print $row["level"]; ?></td>
<td><?php print $row["guild_rank"]; ?></td>
</tr>
<?php
}
?>
</table>
</center>
<?php
// including footer of xoops
include(XOOPS_ROOT_PATH."/footer.php");
// done
?>