-3

编辑:我知道错误就在这里:

$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());

$db = @mysql_select_db($db_name,$connection) or die(mysql_error());

$sql = "SELECT * FROM authorize WHERE username = '$_SESSION[user_name]' and password = '$_SESSION[password]'";

$result = @mysql_query($sql, $connection) or die(mysql_error());

$num = mysql_num_rows($result);

$lstbalance = 0;
$balance = 0;

//set session variables if there is a match
if ($num != 0) 
{
    while ($sql = mysql_fetch_object($result)) 
    {
    $lstbalance = $sql -> lostbalance;
    $balance = $sql -> balance;
    }
}

if ($win==true) 
{
$sql = "update users set lostbalance='($lstbalance+(($payouts[$result1.\'|\'.$result2.\'|\'.$result3])*(int)$_POST[\'bet\']))' WHERE username = '$_SESSION[user_name]' and password = '$_SESSION[password]'";
}
else
{
$sql = "update users set lostbalance='(lstbalance-(int)$_POST[\'bet\'])' WHERE username = '$_SESSION[user_name]' and password = '$_SESSION[password]'";
}
$result = @mysql_query($sql, $connection) or die(mysql_error());

我能够将错误缩小到这段代码,感谢帮助。问候。

当我将其注释掉时,一切似乎都正常工作,所有连接变量都来自不同的文件并且是有效的。

4

1 回答 1

1
$lostbalance = $lstbalance+(($payouts[$result1])*(int)$_POST['bet']));
$sql = "update users set lostbalance='$lostbalance' WHERE username = '".$_SESSION['user_name']."' and password = '".$_SESSION['password']."'";

我不了解您在 $payout[$result1.\'|\'.$result2.\'|\'.$result3] 上的代码

于 2012-04-25T20:51:29.970 回答