0

我遇到了一个不起作用的查询问题。

需要将等级设置为 2 的工作,但需要将 vip 设置为 1 的工作不起作用。

我只是得到一个白页。

问题是什么?

<?php
session_start();
include ("includes/config.php");

$lid = $_SESSION['lid'];

$uQuery = mysql_query("SELECT * FROM users WHERE id = '".$lid."'");
while($uFetch = mysql_fetch_array($uQuery)){
        $uuser = $uFetch['username'];
        $umotto = $uFetch['motto'];
        $ucredits = $uFetch['credits'];
        $upixels = $uFetch['activity_points'];
        $ubelcr = $uFetch['belcredits'];
        $urank = $uFetch['rank'];
        $ufigure = $uFetch['look'];
}

if($urank < '2'){
mysql_query("UPDATE users SET rank = 2 WHERE id = '".$lid."'");
mysql_query("UPDATE users SET vip = 1 WHERE id = '".$lid."'");
}



Header("vip.php?succes=1");
?>
4

2 回答 2

3
mysql_query("UPDATE users SET rank = 2,vip = '1' WHERE id = '".$lid."'");
于 2013-04-28T07:41:56.537 回答
2

不完全是您要查找的内容,但查看可以简化为的查询:

session_start();
include ("includes/config.php");
if(isset($_SESSION['lid'])){

$lid = $_SESSION['lid'];
$query = "UPDATE users SET rank = 2, vip = '1' WHERE rank < 2 AND id = ".intval($lid);
$result = mysql_query($query) or die(mysql_error());
header('Location: vip.php?succes=1');
exit;
}
于 2013-04-28T07:42:21.193 回答