Error When Trying to Edit Table

Forum
Last Post
Threads / Messages

Hwona

Member
Member
Joined
Mar 1, 2013
Messages
620
Points
0
Mysidian Dollar
31,589
Does anyone know what I'm doing wrong with this?:
PHP:
   $totalAdopts = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' && tab = 0");	
		$totalAdopts2 = $totalAdopts->rowCount();
		$pagination = new Pagination($totalAdopts2, 10, "myadopts");
        $pagination->setPage($mysidia->input->get("page"));
        
		$stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' && tab = 0 ORDER BY totalclicks LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
		if($stmt->rowCount() == 0){
		    $document->addLangvar($mysidia->lang->empty);
		    return;
		}
		
	    $adoptTable = new TableBuilder("adopttable", 650);


for($row = 0; $row < 13; $row++){
	        $adoptRow = new TRow("row{$row}");
            for($column = 0; $column < 5; $column++){
		
		while($aid = $stmt->fetchColumn()){
		    $adopt = new OwnedAdoptable($aid);
		    $gender = new TCell($adopt->getGender("gui"));
			$nametype = new TCell("<em>{$adopt->getName()}</em> the {$adopt->getType()}");
			$image =new Link("myadopts3/manage/{$aid}", $adopt->getImage("gui"));
			$clicks = $adopt->getTotalClicks();
			$level = $adopt->getCurrentLevel();
			$adoptCell = new TCell(new ArrayObject(array($image)), "cell{$index}");
                $adoptCell->setAlign(new Align("center", "center"));
				$adoptRow->add($adoptCell);
		}}}
$adoptTable->add($adoptRow);
I'm getting this error: Fatal error: Call to a member function count() on a non-object in /home/wallie12/public_html/classes/abstract/abstract_guicontainer.php on line 392

Thanks a bunch! :D
 
Theres a chance that a cell or a row of your table has no content, this is usually where the count() member function error occurs.
 
The cells and rows look full... umm, I tried editing the "index" thing, but nothing' changing...
edit: whenever I do:
$totalAdopts = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' && tab = 0")->fetchColumn();
$totalAdopts2 = $totalAdopts->rowCount();

instead of:
$totalAdopts = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' && tab = 0");
$totalAdopts2 = $totalAdopts->rowCount();

I get this: Fatal error: Call to a member function count() on a non-object in /home/wallie12/public_html/myadopts3.php on line 30
 
Last edited:
Your first 0 doesn't have a semicolon.
$totalAdopts = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' && tab = 0")->fetchColumn();
$totalAdopts2 = $totalAdopts->rowCount();

Or maybe it doesn't matter? I dunno.
 
^ Thanks, but I actually had that before I tried to change the table, but it worked then.
 
^ No, I was just trying to explain that that wasn't the part that wasn't functioning well. ^.^ I may just end up trying to simply style the tables, but I don't know how to do that either. XP
 

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,280
Messages
33,130
Members
1,603
Latest member
Monako
BETA

Latest Threads

Latest Posts

Top