• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Gesior Guilds.php

Lightonia

Lightonia.servegame.com
Joined
Jun 4, 2007
Messages
492
Reaction score
9
I am having issues with guilds.php on gesior 2012
Creating a guild isn't a problem neither having one, but when you go into a specific guild(any guild)
it gives me a error on the website
You can check it out on; http://lightonia.com/?subtopic=guilds&action=show&guild=80
or
Code:
 Fatal error: Call to a member function fetchAll() on a non-object in /home/otsmanager/www/public_html/classes/databaselist.php on line 68 Call Stack: 0.0001 635744 1. {main}() /home/otsmanager/www/public_html/index.php:0 0.0132 1778712 2. include_once('/home/otsmanager/www/public_html/system/load.page.php') /home/otsmanager/www/public_html/index.php:37 0.0155 2867656 3. include('/home/otsmanager/www/public_html/pages/guilds.php') /home/otsmanager/www/public_html/system/load.page.php:7 0.0240 4061368 4. count(class DatabaseList { public $data = NULL; public $iterator = 0; public $class = 'Player'; public $table = 'players'; public $tables = array ('players' => 'players', 'guild_invites' => 'guild_invites'); public $fields = array (0 => 'id', 1 => 'name', 2 => 'world_id', 3 => 'group_id', 4 => 'account_id', 5 => 'level', 6 => 'vocation', 7 => 'health', 8 => 'healthmax', 9 => 'experience', 10 => 'lookbody', 11 => 'lookfeet', 12 => 'lookhead', 13 => 'looklegs', 14 => 'looktype', 15 => 'lookaddons', 16 => 'maglevel', 17 => 'mana', 18 => 'manamax', 19 => 'manaspent', 20 => 'soul', 21 => 'town_id', 22 => 'posx', 23 => 'posy', 24 => 'posz', 25 => 'conditions', 26 => 'cap', 27 => 'sex', 28 => 'lastlogin', 29 => 'lastip', 30 => 'save', 31 => 'skull', 32 => 'skulltime', 33 => 'rank_id', 34 => 'guildnick', 35 => 'lastlogout', 36 => 'blessings', 37 => 'balance', 38 => 'stamina', 39 => 'direction', 40 => 'loss_experience', 41 => 'loss_mana', 42 => 'loss_skills', 43 => 'loss_containers', 44 => 'loss_items', 45 => 'premend', 46 => 'online', 47 => 'marriage', 48 => 'promotion', 49 => 'deleted', 50 => 'description', 51 => 'create_ip', 52 => 'create_date', 53 => 'comment', 54 => 'hide_char'); public $extraFields = array (); public $filter = class SQL_Filter { public $leftSide = class SQL_Filter { ... }; public $filterType = ' AND '; public $rightSide = class SQL_Filter { ... }; public $bracket = FALSE; public $tables = array (...) }; public $orders = array (0 => class SQL_Order { ... }); public $limit = NULL; public $offset = 0 }) /home/otsmanager/www/public_html/pages/guilds.php:223 0.0240 4061368 5. DatabaseList->count() /home/otsmanager/www/public_html/pages/guilds.php:223 0.0240 4061368 6. DatabaseList->load() /home/otsmanager/www/public_html/classes/databaselist

Thanks!
 
Code:
<?php
if(!defined('INITIALIZED'))
    exit;

class DatabaseList extends DatabaseHandler implements Iterator, Countable
{
    public $data;
    public $iterator = 0;
    public $class;
    public $table;
    public $tables = array();
    public $fields = array();
    public $extraFields = array();
    public $filter;
    public $orders = array();
    public $limit;
    public $offset = 0;

    public function __construct($class = null)
    {
        if($class !== null)
            $this->setClass($class);
    }

    public function load()
    {
        $fieldsArray = array();

        if(count($this->fields) > 0)
            foreach($this->fields as $fieldName)
                    $fieldsArray[$fieldName] = $this->getDatabaseHandler()->tableName($this->table) . '.' . $this->getDatabaseHandler()->fieldName($fieldName);

        if(count($this->extraFields) > 0)
            foreach($this->extraFields as $field)
                if(!$field->hasAlias())
                    $fieldsArray[] = $this->getDatabaseHandler()->tableName($field->getTable()) . '.' . $this->getDatabaseHandler()->fieldName($field->getName());
                else
                    $fieldsArray[] = $this->getDatabaseHandler()->tableName($field->getTable()) . '.' . $this->getDatabaseHandler()->fieldName($field->getName()) . ' AS ' . $this->getDatabaseHandler()->fieldName($field->getAlias());

        $tables = array();
        foreach($this->tables as $table)
            $tables[] = $this->getDatabaseHandler()->tableName($table);

        $filter = '';
        if($this->filter !== null)
            $filter = ' WHERE ' .$this->filter->__toString();

        $order = '';
        $orders = array();
        if(count($this->orders) > 0)
        {
            foreach($this->orders as $_tmp_order)
                $orders[] = $_tmp_order->__toString();
            if(count($orders) > 0)
                $order = ' ORDER BY ' . implode(', ', $orders);
        }

        $limit = '';
        if($this->limit !== null)
            $limit = ' LIMIT ' . (int) $this->limit;

        $offset = '';
        if($this->offset > 0)
            $offset = ' OFFSET ' . (int) $this->offset;

        $query = 'SELECT ' . implode(', ', $fieldsArray) . ' FROM ' . implode(', ', $tables) . $filter . $order . $limit . $offset;

        $this->data = $this->getDatabaseHandler()->query($query)->fetchAll();
    }

    public function getResult($id)
    {
        if(!isset($this->data))
            $this->load();
        if(isset($this->data[$id]))
        {
            if(!is_object($this->data[$id]))
            {
                $_tmp = new $this->class();
                $_tmp->loadData($this->data[$id]);
                return $_tmp;
            }
            else
                return $this->data[$id];
        }
        else
            return false;
    }

    public function addExtraField($field)
    {
        $this->extraFields[] = $field;
        $this->addTables($field->getTable());
    }

    public function addOrder($order)
    {
        $this->orders[] = $order;
    }

    public function setClass($class)
    {
        $this->class = $class;
        $instance = new $this->class();
        $this->fields = $instance::$fields;
        if(isset($instance::$extraFields))
            foreach($instance::$extraFields as $extraField)
            {
                if(!isset($extraField[2]))
                    $this->extraFields[] = new SQL_Field($extraField[0], $extraField[1]);
                else
                    $this->extraFields[] = new SQL_Field($extraField[0], $extraField[1], $extraField[2]);
                $this->tables[$extraField[1]] = $extraField[1];
            }
        $this->table = $instance::$table;
        $this->tables[$instance::$table] = $instance::$table;
    }

    public function setFilter($filter)
    {
        $this->addTables($filter->getTables());
        $this->filter = $filter;
    }

    public function setLimit($limit)
    {
        $this->limit = $limit;
    }

    public function setOffset($offset)
    {
        $this->offset = $offset;
    }

    public function addTables($tables)
    {
        if(is_array($tables))
        {
            foreach($tables as $table)
                if($table != '' && !in_array($table, $this->tables))
                    $this->tables[$table] = $table;
        }
        elseif($tables != '' && !in_array($tables, $this->tables))
            $this->tables[$tables] = $tables;
    }

    public function current()
    {
        return $this->getResult($this->iterator);
    }

    public function rewind()
    {
        if(!isset($this->data))
            $this->load();
        $this->iterator = 0;
    }

    public function next()
    {
        ++$this->iterator;
    }

    public function key()
    {
        return $this->iterator;
    }

    public function valid()
    {
        return isset($this->data[$this->iterator]);
    }

    public function count()
    {
        if(!isset($this->data))
            $this->load();
        return count($this->data);
    }
}
 
Back
Top