• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved [PHP] How to get the player name on Znote AAC?

Joined
Jul 18, 2014
Messages
193
Solutions
2
Reaction score
15
Hi!, i'm trying to put a reset system, it's already done but i want to put in highscores and onlinelist how many resets have a player. The count is on a storage and this is my code in highscores.php but i need get the player name and i don't know how.
PD: The problem is on: $playerID

PHP:
<table id="highscoresTable" class="table table-striped table-hover">
        <tr class="yellow">
            <td>Rank</td>
            <td>Name</td>
            <td>Vocation</td>
            <td>Level</td>
            <?php if ($type === 7) echo "<td>Points</td>"; ?>
            <td>Resets</td>
        </tr>
        <?php

        for ($i = 0; $i < count($scores[$type]); $i++) {
           
            if (pageCheck($i, $page, $rowsPerPage)) {
               
                $playerID = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '".I DONT KNOW WHAT TO PUT HERE TO GET THE PLAYER NAME."';");
           
            $resets = mysql_select_single("SELECT `value` FROM `player_storage` WHERE (`key` = 86228 AND `player_id` = '". $playerID['id'] ."');");
            if ($resets['value'] == -1) { $reset = "0"; }
            elseif ($resets['value'] == 1) { $reset = "1"; }
            elseif ($resets['value'] == 2) { $reset = "2"; }
            else { $reset = "Unknown"; }
                ?>
                <tr>
                    <td><?php echo $i+1; ?></td>
                    <td><a href="characterprofile.php?name=<?php echo $scores[$type][$i]['name']; ?>"><?php echo $scores[$type][$i]['name']; ?></a></td>
                    <td><?php echo vocation_id_to_name($scores[$type][$i]['vocation']); ?></td>
                    <td><?php echo $scores[$type][$i]['value']; ?></td>
                    <?php if ($type === 7) echo "<td>". $scores[$type][$i]['experience'] ."</td>"; ?>
                    <td><?php echo $reset; ?></td>
                </tr>
                <?php
        }
        }
        ?>
    </table>

I tried everything but i doesn't works. Please Help!.
 
try

Code:
$playerID = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '".I DONT KNOW WHAT TO PUT HERE TO GET THE PLAYER NAME."';");
to
Code:
$playerID = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '".$scores[$type][$i]['name']."';");
 
try

Code:
$playerID = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '".I DONT KNOW WHAT TO PUT HERE TO GET THE PLAYER NAME."';");
to
Code:
$playerID = mysql_select_single("SELECT `id` FROM `players` WHERE `name` = '".$scores[$type][$i]['name']."';");

I said there was an error with that you said, but i changed something and now works perfectly. Thank you very much! :D
 
I think you can get player id without playerID query by ".$scores[$type][$i]['id']."

Try this
Code:
$resets = mysql_select_single("SELECT `value` FROM `player_storage` WHERE (`key` = 86228 AND `player_id` = '". $scores[$type][$i]['id'] ."');");
 
I think you can get player id without playerID query by ".$scores[$type][$i]['id']."

Try this
Code:
$resets = mysql_select_single("SELECT `value` FROM `player_storage` WHERE (`key` = 86228 AND `player_id` = '". $scores[$type][$i]['id'] ."');");

Works perfectly with the previously code. Thanks :D
 
Back
Top