[PHP]Help me with get account data
#1

Okay so i am trying to display the data of the player that has been clicked. Its almost working but for some reason it always just displays the name of the first person in the database. This is the code:
PHP код:
<?php
global $mysql// we are going to use mysql right? :P
if (isset($_GET['Name'])) { 
      
$page  mysqli_escape_string($mysql, (int)$_GET['Name']); // let's make sure that we just get the integer and not a attempt to do sql injection
        
$query mysqli_query($mysql"SELECT * FROM `Users` WHERE `Name` = {$page}");
        if(!
mysqli_num_rows($query)) { // if the club requested does not exists...
            
header("Location: ?p=Topscores");
            exit;
        }
        
$data mysqli_fetch_array($query); // $data['ROW_NAME'];
        
echo $data['Name'];
 } else { 
?>
    <h1>Top 20 players with the highest score</h1>
    <table width="960" border=1 frame=void rules=rows>
        <tr>
            <td>Pos.</td>
            <td>Name</td>
            <td>Score</td>
            <td>Truckloads</td>
            <td>Convoy score</td>
        <tr>
        <?php 
        $Count 
1;
        
$query mysqli_query($mysql"SELECT * FROM `Users` ORDER BY `Score` DESC LIMIT 0,100");
        while(
$row mysqli_fetch_array($query)) { 
        echo 
'
        <tr>
            <td>'
.$Count.'</td>
            <td><a href="?p=Topscores&Name='
.$row['Name'].'">'.$row["Name"].'</a></td>
            <td>'
.$row["Score"].'</td>
            <td>'
.$row["TJobs"].'</td>
            <td>'
.$row["CJobs"].'</td>
        </tr> '
;
        
$Count++; } ?>
    </table>
<?php ?>
<br><br><br>
Does anyone know why it always displays the first person in database?
Reply


Messages In This Thread
[PHP]Help me with get account data - by thimo - 12.02.2014, 13:56
Re: [PHP]Help me with get account data - by kN1GhT - 12.02.2014, 14:22
Re: [PHP]Help me with get account data - by thimo - 12.02.2014, 14:26
Re: [PHP]Help me with get account data - by Kirollos - 12.02.2014, 14:49
Re: [PHP]Help me with get account data - by thimo - 12.02.2014, 15:37

Forum Jump:


Users browsing this thread: 1 Guest(s)