我有以下代码,当我尝试保存10个以上学生的成绩时,在从表格中读取标记,名称和准入的行上出现未定义的偏移错误,输入表格包含在表格行中, 对于10条或更少的记录,它可以保存,但10条以上的记录将失败
if(isset($_POST['submit']))
{
//maxipain & kenny @codei
for($i=0;$i<$_POST['count'];$i++)
{
$mark[$i]=$obj->con->real_escape_string(htmlentities($_POST['cat1'][$i]));
$names[$i]=$obj->con->real_escape_string(htmlentities($_POST['names'][$i]));
$admission[$i]=$obj->con->real_escape_string(htmlentities($_POST['admission'][$i]));
$key[$i]=$year . $term . $subject . $_POST['admission'][$i];
if($mark[$i]>0)
{
if($mark[$i]<=30 && is_numeric($mark[$i]))
{
/*
* if marks are consistent,
check if previous results
exist
*/
$where=array("admission"=>$admission[$i],"period"=>$period,"subject"=>$subject);
$fetch_results=$obj->fetch_records("results",$where);
//if results for selected subject exist in results table
if($fetch_results)
{
foreach($fetch_results as $row)
{
$total[$i] = $row['total'] + $mark[$i];
//getting grade for updating
$sql = "SELECT * FROM grading_system WHERE upper_limit>=floor($total[$i]) AND lower_limit<=floor($total[$i])";
$execute = mysqli_query($obj->con, $sql);
if ($execute) {
while ($get_grades = mysqli_fetch_assoc($execute)) {
$grade[$i] = $get_grades['grade'];
$points[$i] = $get_grades['points'];
$remarks[$i] = $get_grades['remarks'];
}
//updating data to subject results table
$data = array(
"cat" => $mark[$i],
"total" => $total[$i],
"grade" => $grade[$i],
"points" => $points[$i],
"remarks" => $remarks[$i],
"cat_entered" => '1'
);