• 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!

Solved [MyACC] Call to a member function getID() on null

Izaack

Member
Joined
Jun 18, 2012
Messages
70
Solutions
1
Reaction score
17
Location
México
What's up friends, I've been trying to correct this error but I couldn't, could someone help me?
is for a storage query for a top frags box.

error web.png

I would be very grateful if you could help me, my error says a function but I don't know where it is or if it has to be created
SQL:
$storageData = $SQL->query('SELECT `key`, `value` FROM `player_storage` WHERE `player_id` = '.$player->getID().' AND `key` = 65118')->fetch();
     if ($storageData) {
            $storageValue = (int) $storageData['value'];
        }
 
You need to post more code, the context is important.

From that little part, I cannot say whats wrong.

If you want to get storages for all players then you don't need this part:
Code:
`player_id` = '.$player->getID().' AND
 
Ontop of what Slaw said, if you are fetching all players, don't forget to add a LIMIT 5 or however many results you want, and ORDER BY value DESC. And remember to cache it for x minutes/hours, if MyAcc doesn't explicitly do it for you.
 
Back
Top