0

我只想知道将变量中的值插入数据库中的表的正确方法是什么。我做错了吗?

**$mysqli->query("INSERT INTO `trade_history1` (user_id, trade_id, selection, date, type, size, bidprice, offerprice, stoploss, takeprofit,dateclose,close,profitandloss)
    SELECT user_id, trade_id, selection, date, type, size, bidprice, offerprice, stoploss, takeprofit, 'null','null','null'**
    FROM `opentrades`
    WHERE `trade_id` = " . $trade_id);
    $mysqli-> query("UPDATE trade_history1 set dateclose=CURRENT_TIMESTAMP WHERE `trade_id` = " . $trade_id);
    **$mysqli-> query("UPDATE trade_history1 set close='{$closedb}' WHERE `trade_id` = " . $trade_id);**
    **$mysqli-> query("UPDATE trade_history1 set profitandloss='{$profitandloss}' WHERE `trade_id` = " . $trade_id);**

    $mysqli->query("DELETE FROM `opentrades` WHERE `trade_id` = " . $trade_id);
4

1 回答 1

0

你的意思是这样的吗?

$mysqli->query("UPDATE trade_history1 set profitandloss='" . addslashes($profitandloss) . "' WHERE `trade_id` = '" . addslashes($trade_id) . "'");

我没有看到这些变量的任何声明。

于 2013-08-18T19:37:32.907 回答