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

PHP Call Storage on Web

alejandro762

Well-Known Member
Joined
Sep 6, 2021
Messages
225
Reaction score
64
Hello

We want to know how we can call a storage from web (using znote AAC ),

As i discovered this:
Lua:
if ($config['Ach']) {
                $user_id = (int) $user_id;
                $achievementPoints = mysql_select_single("SELECT SUM(`value`) AS `sum` FROM `player_storage` WHERE `key` LIKE '30___' AND `player_id`={$user_id} LIMIT 1");
            }

So i decide made the same with another name:
Code:
if ($config['Storage']) {
                $user_id = (int) $user_id;
                $storagePoint= mysql_select_single("SELECT SUM(`value`) AS `sum` FROM `player_storage` WHERE `key` LIKE '15___' AND `player_id`={$user_id} LIMIT 1");
            }

on config.php added:
Code:
$config['Storage'] = true;

Then added the code on characterprofile.php:
Code:
<?php if ($config['Storage'] && (int)$storagePoint['sum'] > 0): ?>
                    <tr>
                        <td>Storage</td>
                        <td><?php echo (int)$storagePoint['sum']; ?></td>
                    </tr>
                <?php endif; ?>

It seems working, but when i add a new one under, with another storage it 'disappear' from website and doesn't show the number on website.
There is an alternative to call a storage using php , instead of 'like' with a exact number value ?
'15___' = 5 Digits, 6 digits doesn't work also.
 
To match an exact key:
Code:
WHERE `key` = '1545645'

Not sure what you mean with the rest, but the value wont show if the database doesn't return anything:
Code:
if ($config['Storage'] && (int)$storagePoint['sum'] > 0):
it will only show the whole html block if config['storage'] is true AND the sum being returned is more than 0.
 
To match an exact key:
Code:
WHERE `key` = '1545645'

Not sure what you mean with the rest, but the value wont show if the database doesn't return anything:
Code:
if ($config['Storage'] && (int)$storagePoint['sum'] > 0):
it will only show the whole html block if config['storage'] is true AND the sum being returned is more than 0.
Yes it will return true if there is more than 0.
I will use an instant storage moving onEquip and deEquip, but isnt updated on web.

Since znote takes 5 digits in value 'key' i edited to 5 digits, but is working only for ' storage not moving '. Is possible this type of storage needs a reset console everytime ?

How to show 0 for a storage ? And more if is higher than 0 at same Time?
 
Last edited:
Back
Top