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發送數據,如果這很重要的話。