Why won't it save the sort anymore (After Maple added in a tabs feature for our adopts)?
PHP Code:
include("inc/functions.php");
//***************//
// START SCRIPT //
//***************//
$id = $_GET["id"];
$act = $_GET["act"];
$more = $_GET["more"];
$abilityid = $_GET["abilityid"];
$tab = $_GET['tab'];
if($isloggedin == "yes"){
if($act == ""){
$tabs = gettabs();
$article_title .="{$loggedinname}'s Den";
$article_content .="
<table width='60%' style='text-align:center;' class='shop'><center><tr><td><p class='sort' id='activate_sort'>
Sort Adopts - Currently NOT Working.
</p><center></td></tr></table></center>
<table width='60%' style='text-align:center;' class='shop'><tr><td width='20%'><a href='trade.php'>Trade</a>-<a href='search.php'>Search</a></td>
<td width='20%'><a href='breeding.php'>Breed</a></td>
<td width='20%'><a href='embed.php'>Embed All</a></td>
<td width='20%'><a href='inventory.php'>Kit Inventory</a></td><td width='20%'><a href='inventory2.php'>Adult Inventory</a></td></tr></table></center>
<br>
<table width='60%' style='text-align:center;' class='shop'><tr><td width='20%'><a href='tab.php'>Manage Dens</td></a>
<td width='20%'>Select a den to go to: <select name='tab' id='tab' ONCHANGE='location = this.options[this.selectedIndex].value;'>
<option value='#'>Please Select one below:</option><option value='myadopts.php'>Default</option>".$tabs."
</select></td>
</tr></table></center>
<br><div style='float:left;'>";
$query = "SELECT * FROM ".$GLOBALS['prefix']."owned_collectables WHERE type = 'Halloween' AND owner = '".$loggedinname."'";
$result = runquery($query);
$num = mysql_numrows($result);
if($num > 0){
$article_content .="<img src='images/candypumpkin.png' title='Trick or Treat 2011'>";
}else{
$article_content .="";
}
$query = "SELECT * FROM ".$GLOBALS['prefix']."owned_adoptables WHERE type = '911 Silvfox' AND owner = '".$loggedinname."'";
$result = runquery($query);
$num = mysql_numrows($result);
if($num > 0){
$article_content .="<img src='images/us.png' title='911 Event'>";
}else if($type == '911 Wolf'){
$article_content .="<img src='images/us.png' title='911 Event'>";
}else{
$article_content .="";
}
$query = "SELECT * FROM ".$GLOBALS['prefix']."owned_adoptables LEFT JOIN ".$GLOBALS['prefix']."sort_adoptables
ON ".$GLOBALS['prefix']."owned_adoptables.aid = ".$GLOBALS['prefix']."sort_adoptables.adoptable_id WHERE owner = '".$loggedinname."' ORDER BY ".$GLOBALS['prefix']."sort_adoptables.sorting_id, ".$GLOBALS['prefix']."owned_adoptables.currentlevel ASC";
$result = runquery($query);
$numpets = mysql_numrows($result);
if($numpets >= 500){
$article_content .="<img src='/images/trophy-gold.png' title='Gold Trophy - Over 500 SilvAdopts'>";
} else if($numpets >= 200){
$article_content .="<img src='/images/silvertrophy.png' title='Silver Trophy - Over 200 SilvAdopts'>";
} else if($numpets >= 50){
$article_content .="<img src='/images/trophy-bronze.png' title='Bronze Trophy - Over 50 SilvAdopts'>";
}else{
$article_content .="";
}
$article_content .="</div><br><br>
<br>Share this link with others to show them your Den<br>
<input type='text' size='100' value='http://silvadopts.com/profile.php?user=$loggedinname'><br>
<a href='http://silvadopts.com/profile.php?user=$loggedinname'>http://silvadopts.com/profile.php?user=$loggedinname</a><br>";
$article_content .= "<div style='height:100%;
color: #fff;
border: 1px solid #282828;
border-top: 1px solid #363636;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px;'><table style='width: 100%;' class='madopt' id='sortable_adoptables' ><tbody>
<tr><th>SilvAdopt</th><th>Name</th><th>Level</th><th>Manage</th><th>Get Codes</th><th>Clicks</th></tr><br>";
// We need to get all of the user's adoptables from the database and display them...
/* $query = "SELECT * FROM ".$prefix."owned_adoptables, ".$prefix."levels WHERE ".$prefix."owned_adoptables.owner = '{$loggedinname}'"
." AND ".$prefix."owned_adoptables.type = ".$prefix."owned_adoptables.type AND ".$prefix."levels.thisislevel = ".$prefix."owned_adoptables.currentlevel AND ".$prefix."levels.adoptiename = "
.$prefix."owned_adoptables.type ORDER BY ".$prefix."owned_adoptables.sort, ".$prefix."owned_adoptables.totalclicks";
*/
$query = " SELECT *
FROM {$prefix}owned_adoptables
LEFT JOIN {$prefix}sort_adoptables
ON {$prefix}owned_adoptables.aid = {$prefix}sort_adoptables.adoptable_id
INNER JOIN {$prefix}levels
ON {$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel
INNER JOIN {$prefix}adoptables
ON {$prefix}owned_adoptables.type = {$prefix}adoptables.type
WHERE {$prefix}owned_adoptables.owner = '{$loggedinname}' AND {$prefix}owned_adoptables.tab = '{$tab}'
AND {$prefix}levels.adoptiename = {$prefix}adoptables.type
ORDER BY {$prefix}sort_adoptables.sorting_id, {$prefix}owned_adoptables.currentlevel ASC";
$result = runquery($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$aid=@mysql_result($result,$i, $prefix."owned_adoptables.aid");
$currentlevel=@mysql_result($result,$i, $prefix."owned_adoptables.currentlevel");
$gender=@mysql_result($result,$i, $prefix."owned_adoptables.gender");
$isfrozen=@mysql_result($result,$i, $prefix."owned_adoptables.isfrozen");
$type=@mysql_result($result,$i, $prefix."owned_adoptables.type");
$name=@mysql_result($result,$i, $prefix."owned_adoptables.name");
$eggimage=@mysql_result($result,$i, $prefix."adoptables.eggimage");
$usealternates=@mysql_result($result,$i, $prefix."owned_adoptables.usealternates");
$totalclicks=@mysql_result($result,$i, $prefix."owned_adoptables.totalclicks");
$primaryimage=@mysql_result($result,$i, $prefix."levels.primaryimage");
$alternateimage=@mysql_result($result,$i, $prefix."levels.alternateimage");
if ($usealternates=='yes') { $image = $alternateimage; }
else { $image = $primaryimage; }
if ($currentlevel==0) { $image = $eggimage; }
if ($image=='') { $image = $primaryimage; }
$article_content .= "<tr id='orderaid_{$aid}'><td width='20%'><a href='myadopts.php?act=stats&id=".$aid."'><img src='$image'></a></td><td width='20%'>";
if($isfrozen == 'no') {
$article_content .= '';
} else {
$article_content .= '<img src=\'images/snowflake.png\'>';
}