1

我有奇怪的错误,我有 2 查询添加和更新。添加查询工作但更新不工作。这是我的代码

<?php
session_start();
require("dbc.php");
$volume = mysql_real_escape_string($_POST["volume"]);
$price = mysql_real_escape_string($_POST["price"]);
$type = mysql_real_escape_string($_POST["type"]);
$margin = $_SESSION['margin'];

if($volume > 0 )
{
    $memberid = $_SESSION['memberid'];
    $margin = $margin + 100;
    $balance = $_SESSION['balance'];
    $sql = "INSERT INTO `open`(`memberid`, `opendate`, `type`, `size`, `openprice`) VALUES ('$memberid',now(),'$type','$volume','$price')";
    $sql2 = "UPDATE  `member` SET  `margin` ='$margin',`openpos` ='$margin' WHERE  `memberid` = '$memberid'";
        if($balance >= 50){
            mysql_query($sql);
            mysql_query($sql2);
            echo("success");
            }
        else
        {
            echo("Your balance is not enough for open new trade");
            echo($memberid);
            }
    }
else
{
    echo("You cant trade zero amount");
    echo ($volume);
    }?>

请帮帮我谢谢:)

4

0 回答 0