我想在点击“保存amt”按钮时更新复选框检查的行。请帮助我收到错误。
<?php
include_once("config.php");
if(isset($_POST['submit']))
{
$paitAmt = $_POST['paidamt'];
$uid = $_POST['uid'];
$array = array($paitAmt, $uid);
foreach ($array as list($paitAmt, $uid)) {
$sql = "UPDATE tbldemo SET paidAmt = '$paitAmt' WHERE id = '$uid'";
echo $sql;
$result = mysql_query($sql);
echo 'Updated Successfully';
}
}
?>
答案 0 :(得分:1)
试试这个:
<?php
include_once("config.php");
if(isset($_POST['submit']))
{
$paitAmt = $_POST['paidamt'];
$uid = $_POST['uid'];
foreach ($paitAmt as $key=>$value) {
$sql = "UPDATE tbldemo SET paidAmt = '$value' WHERE id = '{$uid[$key]}'";
//echo $sql;
$result = mysql_query($sql);
echo 'Updated Successfully';
}
}
?>