0
我有一个FOREACH循环,它不拾取数组中的第一个元素。PHP循环通过一个FOREACH循环
我有一个具有以下内容的提交形式:
<input name="repaired[<?php echo $row_Faults['UniqueID']; ?>]" type="checkbox" id="repaired" value="1" class="required"/>
如果我呼应$ _ POST [“修补”]数组我看到了两个记录,但在运行代码时没有被处理的第一个记录。
foreach($_POST['repaired'] as $uniqueID => $repairedValue){
$updateSQL = sprintf("UPDATE ".$Hist." SET Status=%s, LettoStatus=%s WHERE UniqueID= '".$_POST["UniqueID"]."'",
GetSQLValueString($_POST['Status'] = $StatusCode , "int"),
GetSQLValueString($_POST['LettoStatus'] = $LettoCode , "int"));
mysql_select_db($database_iMaint, $iMaint);
$Result1 = mysql_query($updateSQL, $iMaint) or die(mysql_error());
}
任何人都可以看到我出错的地方。
非常感谢您的时间。
**不要**。 ** **永远。 **使用**。 'mysql_ *'。 –
尽管与您的问题没有直接关系,但我强烈建议您对输入进行消毒。看到http://stackoverflow.com/questions/129677/whats-the-best-method-for-sanitizing-user-input-with-php – pandoraEudora
@kennethPhough感谢您的意见,一旦我得到这个foreach循环工作,我会然后看看卫生。谢谢 – DCJones