INSERT INTO - 子查询 returns 多于 1 行 (PHP/MySQL)

INSERT INTO - Subquery returns more than 1 row (PHP/MySQL)

我正在尝试使用 PHP 和 MySQL 开发一个网站。这是我试过的 PHP 代码:

$sql = sprintf("INSERT INTO request_boms SET
                                request_list_id = %d,
                                project_version_id = %d,
                                amount = %d,
                                user = '%s',
                                timestamp = %d",
                                $requestNo, $bomID, $amount, $_SESSION["admin_user_name"], time());
$this->db_inventory->Execute($sql);

我的 $this->db_inventory 变量与数据库 API 连接。没有问题。但是当我在这里执行代码时 returns 我是这样的:

Subquery returns more than 1 row
INSERT INTO request_boms SET request_list_id = 14, project_version_id = 429, amount = 1, user = 'admin', timestamp = 1607510083

我在这里 (Whosebug) 上搜索了这个问题,但在所有问题的查询中都有 SELECT 语句。我在 INSERT INTO 查询中没有给出任何 SELECT 语句。怎么可能?

编辑(由于评论)

这是我的 Execute()

public function Execute($sql) {
    $rs = new RecordSet($sql, $this->db_type, $this->conn);
    return $rs;
}

RecordSet

class RecordSet {
    public $rs;
    public $db_type;
    public $conn;

    public function RecordSet($sql, $db_type, $conn) {
        $this->db_type = $db_type;
        $this->conn = $conn;
        if ($this->db_type == 'sybase') {
            $rsx =@sybase_query($this->sql_escape($sql)); 
            if (!$rsx) {
                $this->queryError(sybase_get_last_message(),$sql);
            }
        } elseif ($this->db_type == 'mssql') {
            $rsx =@mssql_query($this->sql_escape($sql)); 
            if (!$rsx) {
                $this->queryError(mssql_get_last_message(),$sql);
            }
        } elseif ($this->db_type == 'odbc') {
            $rsx =@odbc_exec($this->conn, $this->sql_escape($sql)); 
            if (!$rsx) {
                $this->queryError(odbc_errormsg(),$sql);
            }
        } else {
            $rsx = mysqli_query($this->conn, $this->sql_escape($sql));
            if (!$rsx) {
                $this->queryError(@mysqli_error($this->conn),$sql);
            }
        }
        $this->rs = $rsx;
    }
}

已解决!

在我的数据库中,我还有一个名为 request_components 的 table。它有 2 个主键:idrequest_list_id。从 table 中删除 request_list_id 键后,问题解决了。这似乎在 table 之间造成了冲突。如果你有这个问题,你应该检查你的数据库。