嗯,我已经尝试过建立排名系统,但它似乎没有用? 我是新人,但学习请放轻松。 这是我检查用户信息的地方
GetInfo.php
# Check if user is valid
session_start();
if(!isset($_SESSION['username'])) {
header('location: login.php');
die();
} else {
$my_username = $_SESSION['username'];
}
# Get User Information
$db_get_user = mysqli_query($con, "SELECT * FROM users WHERE username='$my_username'");
# Get The User Information
$row = mysqli_fetch_array($db_get_user);
$my_email = $row['email'];
if($my_rank = $row['rank'] = 0){
echo '000';
}else if($my_rank = $row['rank'] = 1){
echo '111';
}else if($my_rank = $row['rank'] = 2){
echo '222';
}else if($my_rank = $row['rank'] = 3){
echo '333';
}else if($my_rank = $row['rank'] = 4){
echo '444';
}else if($my_rank = $row['rank'] = 5){
echo '555';
}
?>
答案 0 :(得分:0)
您是否只是想将$ my_rank设置为等于$ row ['rank']?
$my_rank = $row['rank'];
if($my_rank == 0){
echo '000';
}else if($my_rank == 1){
echo '111';
}else if($my_rank == 2){
echo '222';
}else if($my_rank == 3){
echo '333';
}else if($my_rank == 4){
echo '444';
}else if($my_rank == 5){
echo '555';
}