我想更新多个主键中的PIC_ID。 这是我的代码:
//Input from checkbox
<input type="checkbox" name="PSID[]" value="<?php echo $rows['PSID']; ?>" size="5" readonly="readonly"/>
<input type="hidden" name="surveyor" value="<?php echo $_GET['idsurveyor']; ?>" />
//PSID is a primary key
$pic=$_POST['surveyor'];
foreach ($_POST['PSID'] as $key => $value) {
$value;
$pic;
$stmt = $conn->prepare("UPDATE surveyor SET PIC_ID='$pic' WHERE PSID='$value'");
$stmt->execute() ;
} //foreach
//只有一个传入的数据进入表