插入时出现Mysql查询错误

时间:2018-01-14 04:31:36

标签: mysql magento2.1

我使用以下查询插入出价信息,但会引发基数违规错误。

抛出错误如下

SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row, query was: INSERT INTO `auction_bidders` (`property_id`, `customer_id`, `total_bid_amount`, `bid_amount`, `bid_placed_time`, `title_service_charge`, `is_bid_withdrawn`, `is_proxy`) VALUES (?, ?, ?, ?, '2018-01-13 16:53:32', ?, ?, ?)

Code i使用如下

public function placeAuctionBid($property_id, $customer_id, $bid_amount){
        $bidder_data = array(
            'property_id' => $property_id,
            'customer_id' => $customer_id,
            'total_bid_amount' => $bid_amount,
            'bid_amount' => $bid_amount,
            'bid_placed_time' => date('Y-m-d H:i:s'),
            'title_service_charge' => 0,
            'is_bid_withdrawn' => 0,
            'is_proxy'=>1
        );
        $this->biddersModel->setData($bidder_data);
        $this->biddersModel->save();
        $this->initiateBiddingWar();
        return true;
    }

它是一个magento 2.1代码

有什么想法吗?

0 个答案:

没有答案