Jump to content

Recommended Posts

Hi there, Firstly this is a link to my working code/script http://www.nexus-guild.eu/adornments/index.php

 

When you click on one of the body images it pulls all the data from the database for that particular slot and feeds it into a table. I am wondering how i can make it so when you click on the table column descriptions such as the Name/Effect/Quality/Level/Colour/Faction Name/Faction Value it will reorder all the information in ascending order or descending order. Ive looked around quite a bit for this but i cant find anything on this. This is the code im currently using. It has alot of repeating code which makes up the majority of the file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>neXus - Adornments Calculator</title>
<style type="text/css">
<!--
body {
background-color: #2f2626;
}
body,td,th {
color: #000;
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
}
-->
</style></head>

<body text="#FFFFFF" link="#ff8000" vlink="#ff8000" alink="#ff8000">
<center>
  <p> </p>
  <p> </p>
  <p><img src="character.png" border="0" usemap="#Map"/>
    <map name="Map" id="Map">
      <area shape="rect" coords="2,2,44,44" href="index.php?slot=head" />
      <area shape="rect" coords="45,2,85,44" href="index.php?slot=cloak" />
      <area shape="rect" coords="2,46,44,86" href="index.php?slot=chest" />
      <area shape="rect" coords="45,45,85,86" href="index.php?slot=shoulders" />
      <area shape="rect" coords="45,87,85,129" href="index.php?slot=forearms" />
      <area shape="rect" coords="2,87,44,129" href="index.php?slot=legs" />
      <area shape="rect" coords="45,130,85,170" href="index.php?slot=hands" />
      <area shape="rect" coords="3,130,44,170" href="index.php?slot=feet" />
      <area shape="rect" coords="46,172,86,216" href="index.php?slot=charm" />
      <area shape="rect" coords="3,172,45,215" href="index.php?slot=charm" />
      <area shape="rect" coords="45,216,85,257" href="index.php?slot=drink" />
      <area shape="rect" coords="3,216,44,256" href="index.php?slot=food" />
      <area shape="rect" coords="362,2,403,43" href="index.php?slot=waist" />
      <area shape="rect" coords="405,2,443,43" href="index.php?slot=neck" />
      <area shape="rect" coords="362,45,403,86" href="index.php?slot=ear" />
      <area shape="rect" coords="405,45,444,87" href="index.php?slot=ear" />
      <area shape="rect" coords="363,88,402,129" href="index.php?slot=finger" />
      <area shape="rect" coords="405,89,444,128" href="index.php?slot=finger" />
      <area shape="rect" coords="363,131,402,171" href="index.php?slot=wrist" />
      <area shape="rect" coords="405,130,443,170" href="index.php?slot=wrist" />
      <area shape="rect" coords="362,174,404,213" href="index.php?slot=ranged" />
      <area shape="rect" coords="405,173,443,212" href="index.php?slot=ammo" />
      <area shape="rect" coords="362,216,404,256" href="index.php?slot=primary" />
      <area shape="rect" coords="405,216,444,256" href="index.php?slot=secondary" />
    </map>
<br>
<br>

  <p>
<?php
include 'db_connect.php';
if (isset($_GET["slot"])) { $slot  = $_GET["slot"]; } else { $slot=startpage; }; 
$color1 = "#E1FAE2";  
$color2 = "#ffffff";
$row_count = 0;

////////////////////////////////////////////////////////////////////////////////
/////////////////////////////STARTPAGE - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
if ( $slot == "startpage" )
{
echo "This is still in beta. If you find any bugs please send them to <a href=\"mailto:sosia@nexus-guild.eu\">Sosia</a>";


}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////STARTPAGE - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
/////////////////////////////HEAD SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif ( $slot == "head" )
{

$sql = "SELECT * FROM $db_table WHERE for_head = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////HEAD SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////CLOAK  - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif ( $slot == "cloak" )
{

$sql = "SELECT * FROM $db_table WHERE for_cloak = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////CLOAK SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////CHEST SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "chest" )
{

$sql = "SELECT * FROM $db_table WHERE for_chest = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////CHEST SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////SHOULDERS SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "shoulders" )
{

$sql = "SELECT * FROM $db_table WHERE for_shoulders = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////SHOULDERS SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////FOREARMS SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "forearms" )
{

$sql = "SELECT * FROM $db_table WHERE for_forearms = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////FOREARMS SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////LEGS SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "legs" )
{

$sql = "SELECT * FROM $db_table WHERE for_legs = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////LEGS SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////HANDS SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "hands" )
{

$sql = "SELECT * FROM $db_table WHERE for_hands = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////HANDS SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////FEET SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "feet" )
{

$sql = "SELECT * FROM $db_table WHERE for_feet = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////FEET SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////WAIST SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "waist" )
{

$sql = "SELECT * FROM $db_table WHERE for_waist = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////WAIST SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////NECK SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "neck" )
{

$sql = "SELECT * FROM $db_table WHERE for_head = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////NECK SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////EAR SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "ear" )
{

$sql = "SELECT * FROM $db_table WHERE for_head = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////EAR SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////FINGER SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "finger" )
{

$sql = "SELECT * FROM $db_table WHERE for_finger = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////FINGER SLOT - END////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
/////////////////////////////WRIST SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "wrist" )
{

$sql = "SELECT * FROM $db_table WHERE for_head = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////WRIST SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////CHARM SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "charm" )
{

$sql = "SELECT * FROM $db_table WHERE for_charm = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////CHARM SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////PRIMARY SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "primary" )
{

$sql = "SELECT * FROM $db_table WHERE for_primary = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////PRIMARY SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////SECONDARY SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "secondary" )
{

$sql = "SELECT * FROM $db_table WHERE for_head = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////SECONDARY SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////RANGED SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "ranged" )
{

$sql = "SELECT * FROM $db_table WHERE for_head = '1' ORDER BY name"; 
$result = mysql_query ($sql,$db);



    echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"90%\" bgcolor=\"#FFDCCC\">";
echo "<tr> <th align=\"left\">Name</th> <th align=\"left\">Effect</th> <th align=\"left\">Quality</th> <th align=\"left\">Level</th> <th align=\"left\">Colour</th> <th align=\"left\">Faction Name</th> <th align=\"left\">Faction Value</th></tr>";


	while($row = mysql_fetch_array( $result )) 
	{
	$row_color = ($row_count % 2) ? $color1 : $color2; 

	// Print out the contents of each row into a table


	echo "
	<tr>
	<td  bgcolor=\"$row_color\">" . $row["name"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["effect"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["quality"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["level"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["colour"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionname"] . "</td>
	<td  bgcolor=\"$row_color\">" . $row["factionvalue"] . "</td>
	</tr>
	";
	$row_count++;

	} 
	echo "</table>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////RANGED SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////FOOD SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "food" )
{

echo "<font color=#ffffff>Dream on sunshine there aint no food adorns yet</font>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////FOOD SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////DRINK SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "drink" )
{

echo "<font color=#ffffff>Dream on sunshine there aint no drink adorns yet</font>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////DRINK SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////DRINK SLOT - START//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
elseif  ( $slot == "ammo" )
{

echo "<font color=#ffffff>Dream on sunshine there aint no ammo adorns yet</font>";

}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////DRINK SLOT - END////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
else
{
echo "<font color=#ffffff>Either you have clicked something stupidly or edited the url or there is a bug with this script. You should never see this error message. If you do please contact Sosia :No Slot Choosen</font>";
}

?>
</center>
</body>
</html>

 

Link to comment
https://forums.phpfreaks.com/topic/231143-ordering-table-data/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.