One more thing and then I surely will. This sort script worked fine on my old site... Now it's telling me Fatal error: Call to a member function fetchObject() on a non-object in /home/taleofdr/public_html/sort.php on line 51
Code:
<?php
include("functions/functions.php");
include("functions/functions_users.php");
include("functions/functions_adopts.php");
include("classes/class_pagination.php");
include("css/pagination.css");
include("inc/sort.php");
include("inc/lang.php");
//***************//
// START SCRIPT //
//***************//
$id = $_GET["id"];
$act = $_GET["act"];
$more = $_GET["more"];
$page = $_GET["page"];
if($isloggedin == "yes")
{
$article_content = "<p id='activate_sort' style='cursor: pointer'>
Click here to sort your dragons
</p>
<table>";
// We need to get all of the user's adoptables from the database and display them...
$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}levels.adoptiename = {$prefix}adoptables.type
ORDER BY {$prefix}sort_adoptables.sorting_id";
$stmt = $adopts->query($query);
$cols = 6; //the number of columns
do{
$article_content .= "<tr>";
for($i=1;$i<=$cols;$i++){
if($row = $stmt->fetchObject()){
if($row->usealternates == 'yes') $image = $row->alternateimage;
else $image = $row->primaryimage;
if($row->currentlevel == 0) $image = $row->eggimage;
if($image=='') $image = $row->primaryimage;
$article_content .= " <td class='sortable_adoptables' style='width: 40px;'>
<table id='orderaid_{$row->aid}'><tr>
<td><img src='{$image}' width='30px' height='30px'><br>{$row->name}</td>
</tr> </table></td>";
}
else{
$article_content .= "<td> </td>"; //If there are no more records at the end, add a blank column
}
}
} while($row);
$article_content .= "</table>";
}
//***************//
// OUTPUT PAGE //
//***************//
echo showpage($article_title, $article_content, $date);
?>