查询有问题:
$outputs = rosy, rosmary; //array1
$filenames =2.2, 3.2; // array 2
询问:
$insert_col = "UPDATE `lil` SET `D`='" .$output. "' WHERE `A`= '" .$filename. "'";// does not work
当我给出单个值时,它工作得很好,而不是数组,比如:
$insert_col = "UPDATE `lil` SET `D`='rosy' WHERE `A`= '2.2'"; // it works
为了将两个数组放入查询中,我编写了 foreach 循环,如下所示
foreach (array_combine($outputs, $filenames) as $output => $filename) {
$insert_col = "UPDATE `4` SET `D`='" . $output . "' WHERE `A`= '" . $filename . "'";
echo $insert_col;
}
请帮忙 !!