所以我有一个 SQL 选择,它会抓取所有用户的排名,然后在表格中显示它们。但是我现在需要做的是抓住用户是哪个号码。所以目前回声从最高到最低,但我需要找出用户从高到低的位置。
$query = "SELECT
belongsto,
SUM(level) as sumLevel
FROM
user_pokemon
group by
belongsto
order by
sumLevel desc
LIMIT $pageLimit,".PAGE_PER_NO;
我将用户用户名存储在一个$_SESSION['username'];
并且每个怪物的用户名也存储在属于。
这行得通吗?
$query = "select
(count(*) from user_pokemon where belongsto ='".$_SESSION['username']."' ) as position,
belongsto,
level
from user_pokemon
order by level;";
$res=mysql_query($query);