0
我有2個表equip_copy(copyID, equipment_id)
並將其插入到表PHP PDO選擇多行並插入到其他表LIMIT
mre_copy (mreID,copyID,equipment_id)
我已經試過這個選擇查詢,但犯規的舉動。請任何人都可以幫助我?
$display = $con->query("SELECT copyID,equipmentID
FROM equip_copy
WHERE equipmentID= :eid
ORDER BY copyID DESC
LIMIT :elimit");
$display->execute(array("eid" => $id, "elimit"=>$request));
foreach($display as $row){
$newCID = $row['copyID'];
$newEID = $row['equipmentID'];
$sql_table = "INSERT INTO mre_copy(mreID,equipmentID,copyID) values(?,?,?)";
$stmt = $con->prepare($sql_table);
$stmt->execute(array($mreID,$newEID,$newCID));
}
我不能使用while選擇所有數據..什麼是正確的語法 – jin
謝謝你..我會稍後再試。 – jin