PHP如何讓數組值獲取數組值:PHP中使用的foreach
<?php
print_r($_POST['cb']);
Array
(
[0] => Array
(
[id] => 1
[tipe] => read
)
[1] => Array
(
[id] => 1
[tipe] => update
)
[2] => Array
(
[id] => 2
[tipe] => update
)
)
?>
所以我想也許在foreach
功能是這樣的:
foreach(...)
{
$qInsert = oci_parse("INSERT INTO TDATA(ID, CHKSTATUS) VALUES('$getID', '$getTipe')");
oci_execute($qInsert);
}
$getID
指[ID] $getTipe
表示陣列中的[tipe]。
有沒有可能這樣做?
我會建議你:不執行查詢N次,這取決於數組的大小。在單個查詢中插入所有數據 – Shan