PDA

View Full Version : Error When Trying to Edit Table


Hwona
07-31-2014, 11:16 AM
Does anyone know what I'm doing wrong with this?:
$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

Hall of Famer
07-31-2014, 03:25 PM
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.

Hwona
07-31-2014, 06:51 PM
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

squiggler
07-31-2014, 08:41 PM
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.

Hwona
07-31-2014, 09:32 PM
^ Thanks, but I actually had that before I tried to change the table, but it worked then.

Hall of Famer
08-01-2014, 02:07 PM
umm so your problem has been resolved now?

Hwona
08-01-2014, 02:53 PM
^ 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