我的用户排名系统php sql帮帮我

时间:2016-07-13 05:39:33

标签: php profile

see screenshot development 如图所示,红色圆圈的位置应该是用户rankig的数量。例如:1ts,2th,3rd ......

我尝试了所有事情但不是我。

我的表是用户

  ID Name username password Wins Loses

我留下我的php代码文件profile.php

    <?

            require_once('values.inc.php');
            require_once('func.inc.php');


            if(!($_GET[user])) exit('Error.');
            open_conn();

            $res=mysql_query("SELECT ID, Name, username, Thumbnail, LinkText, LinkUrl, country FROM users WHERE Status='1' ORDER BY RAND() LIMIT 2");

            while($row=mysql_fetch_assoc($res)) {



                $username[] = $row[username];
                $ID[] = $row[ID];
                $Thumbnail[] = $row[Thumbnail];
                $Name[] = $row[Name];
                $LinkText[] = $row[LinkText];

            $Model=mysql_query("SELECT ID, Name, username, Wins, Loses, Draws, Thumbnail, LinkText, LinkUrl, country, (Wins) / (Wins+Loses) AS WinPercent, (Wins+Loses+Draws) AS Matches, DATE_FORMAT(DateTime, '%d %M %Y') AS Date FROM users WHERE username='$_GET[user]' LIMIT 1");
            $Model=mysql_fetch_assoc($Model);

            $WinPercent=@round(($Model['Wins'] / ($Model['Wins']+$Model['Loses'])) * 100, 2);
            $LosePercent=@round(($Model['Loses'] / ($Model['Wins']+$Model['Loses'])) * 100, 2);


            if($Model['LinkText'] != '' && $Model['LinkUrl'] != '') {$Url="<br><br><a href=\"$Model[LinkUrl]\">$Model[LinkText]</a>";}


                if($row['LinkText'] != '' && $row['LinkUrl'] != '') {$Url[]="<br><br><a href=\"$row[LinkUrl]\">$row[LinkText]</a><br><br>";}else{$Url[]='';}

            }

            close_conn();

            ?>      



            <?php if (isset($Model['username'])) { ?>
            <div class="content-holder">
                <div class="profile-holder">
                        <div class="profile-image">
                                <img src="images/uploads/<?php echo ucwords($Model['Thumbnail'])?>" class="photo">
                        </div>
                        <div id="photo-upload-holder">

                            <label for="pic" id="photo-upload-label">

                                <h1 class="txtShadow"><?php echo ucwords($Model['Name'])?></h1>
                            </label>

                        </div>
                        <!--<p class=\"userName\">@dada</p>-->
                    </div>

                    <div class="dashboard-Details overFlow">
                    <div class="leftColumn pull">
                            <div class="displayBlock"><br>
                                <i class="heart-icon"></i>
                                <span><?php echo ucwords($Model['Wins'])?></span>
                            </div><br>
                            <div class="displayBlock">
                                <i class="star-icon"></i>
                                <span><?php echo ($WinPercent)?>%</span>
                            </div>
                        </div>

                        <div class="rightColumn push">

                             <h2><?php echo ucwords($Model['username'])?></h2>


            <?php if($Model['country']):?>
            <h4> <?php echo $countrys; ?> <?php echo ucwords($Model['country'])?></h4>
        <?php endif?>
                <?php if($Model['LinkText']):?>
            <h4> Instagram: @<?php echo ucwords($Model['LinkText'])?></h4>
        <?php endif?>   

                                          

                </div>  
                <?php } else { ?>

            <?php echo $profile14; ?>

1 个答案:

答案 0 :(得分:1)

在这里使用引号

$username[] = $row['username'];
$ID[] = $row['ID'];
$Thumbnail[] = $row['Thumbnail'];
$Name[] = $row['Name'];
$LinkText[] = $row['LinkText'];