Solved Search character name error !

Daniel Kopeć

Member
Joined
Dec 8, 2018
Messages
124
Solutions
4
Reaction score
12
Location
Poland
I get this error when searching for a player with a name that does not exist :(

how to fix it?

PHP:
Fatal error: Uncaught exception 'E_OTS_NotLoaded' in C:\xampp\htdocs\pot\OTS_Player.php:1808 Stack trace: #0 C:\xampp\htdocs\characters.php(66): OTS_Player->getCustomField('id') #1 C:\xampp\htdocs\index.php(101): include('C:\xampp\htdocs...') #2 {main} thrown in C:\xampp\htdocs\pot\OTS_Player.php on line 1808

Where could the code be invalid?

pot/OTS_player.php: line 1808>>>

PHP:
public function getCustomField($field)
    {
        if( !isset($this->data['id']) )
        {
            throw new E_OTS_NotLoaded();     [B]<<<line1808[/B]
        }

        $value = $this->db->query('SELECT ' . $this->db->fieldName($field) . ' FROM ' . $this->db->tableName('players') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id'])->fetch();
        return $value[$field];

characters.php: line66>>>

PHP:
if($config['site']['show_vip_status'])
                        {
                         $id = $player->getCustomField("id");  [B]<<<line 66[/B]
                                if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
                           $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=10%>Vip Status:</TD>';
                         $vip = $SQL->query('SELECT * FROM player_storage WHERE player_id = '.$id.' AND `key` = '.$config['site']['show_vip_storage'].';')->fetch();
                           if($vip == false) {
                            $main_content .= '<TD><font color="red"><B>NOT VIP</B></font></TD></TR>';
                            }
                            else

indes.php: line 101>>>

PHP:
case "characters";
        $topic = "Characters";
        $subtopic = "characters";  [B] <<<line 101[/B]
        include("characters.php");
 

WibbenZ

Global Moderator
Staff member
Global Moderator
Joined
Oct 16, 2008
Messages
6,354
Solutions
228
Reaction score
1,425
Location
Sweden
Solution
Top