0
目前,此服务调用仅插入单个(1)记录。不过,我需要能够发送此方法要插入多个记录的真实对象在此调用过程:PHP:处理记录对象,而不仅仅是一条记录
public function savePresentation($assets) {
$stmt = mysqli_prepare($this->connection, "INSERT INTO $this->tablename (presentationid, assetid, positionid) VALUES (?, ?, ?)");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'iii', $assets->presentationid, $assets->assetid, $assets->positionid);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$autoid = mysqli_stmt_insert_id($stmt);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $autoid;
}
我将如何改变这种做法,我可以通过一个关联数组,或类似的东西?
我试过在foreach
声明中包装声明,但它似乎不起作用。 :/
备注:我从Flash发送数据,如果这很重要的话。