Code:
function manage_games($base_url,$bt,$limit){
$content = "<table id=\"t1\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" class=\"example table-autosort:0 table-autofilter table-autopage:$limit table-stripeclass:alternate table-page-number:t1page table-page-count:t1pages table-filtered-rowcount:t1filtercount table-rowcount:t1allcount\">
<thead>
<tr>
<th class=\"table-filterable table-sortable:default\">Title</th>
<th class=\"table-filterable table-sortable:default\">Category</th>
<th class=\"table-sortable:numeric\">Played Today</th>
<th class=\"table-sortable:numeric\">Overall Played</th>
<th class=\"table-filterable table-sortable:default\">Featured</th>
<th class=\"table-sortable:numeric\">REPORTS</th>
<th class=\"table-filterable table-sortable:default\">Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>";
if($bt=="reported")
$sql = "SELECT gameid,gametitle,category,timesplayed,gamestatus,playedtoday,featured,dateadded,reports from games WHERE (gamestatus=3 || reports > 0) ORDER BY gametitle ASC";
elseif ($bt=="submissions")
$sql = "SELECT gameid,gametitle,category,timesplayed,gamestatus,playedtoday,featured,dateadded,reports from games WHERE gamestatus=5 ORDER BY gametitle ASC";
else
$sql = "SELECT gameid,gametitle,category,timesplayed,gamestatus,playedtoday,featured,dateadded,reports from games ORDER BY gametitle ASC";
$result = @mysql_query($sql);
if(mysql_num_rows($result))
{
//output as long as there are still available fields
while($row = mysql_fetch_array($result))
{
$gameid = $row['gameid'];
$gametitle = stripslashes($row['gametitle']);
$category = $row['category'];
$timesplayed = $row['timesplayed'];
$gamestatus = $row['gamestatus'];
$playedtoday = $row['playedtoday'];
$featured = $row['featured'];
$dateadded = $row['dateadded'];
$reports = $row['reports'];
if(strlen($gametitle)>30)
$gametitle = substr($gametitle,0,27)."...";
$gamestatus = get_status($gamestatus);
$category = get_category($category);
if($featured==1)
$featured = "FEATURED";
else
$featured = "";
$gamelink = $base_url."index.php?action=playgame&gameid=$gameid";
$editlink = "index.php?action=editgame&bt=$bt&id=$gameid";
$deletelink = "index.php?action=deletegame&bt=$bt&id=$gameid";
$content.=" <tr>
<td><a href=\"$gamelink\" target=\"_blank\">$gametitle</a></td>
<td>$category</td>
<td>$playedtoday</td>
<td>$timesplayed</td>
<td>$featured</td>
<td>$reports</td>
<td>$gamestatus</td>
<td><a href=\"$editlink\" title=\"Edit Game\"><img src=\"./images/icon_edit.gif\" border=\"0\"></a> / <a href=\"$deletelink\" title=\"Delete Game\"><img src=\"./images/icon_delete.gif\" border=\"0\"></a></td>
</tr>";
}
}else{
$content.="<tr><td colspan=\"7\">No Games Found</td></tr>";
}
$content.="</tbody> <tfoot>
<td colspan=\"7\" class=\"product_listing\" style=\"text-align:center\">
<a href=\"#\" onclick=\"pageexample('previous'); return false;\"><< Previous</a>
Page <span id=\"t1page\"></span> of <span id=\"t1pages\"></span>
<a href=\"#\" onclick=\"pageexample('next'); return false;\">Next >></a>
</td>
</tfoot>
</table>";
return $content;
}
Reason being the default right now is set on "all". The problem with this setting is that it shows ALL the games. That isnt bad if you want to find one specific game....once with a ctrl+f or something. But starting on that page, if you have more than 500 games it must load those 500 games every single time you visit the page. I have over 2500 so the 5-10 seconds this takes to load when i'm trying to move large quantities of games around takes forever.