Hi, good morning,
Dynamically I pass student id, subject id, subject marks.
for example, assume that there are 50 students in a class, subjects are 5. so that 5 fields are there to enter 5 subjects mark. and the total will calculate automatically.
while storing in database , I have a problem that , I have done it using two for loops by counting student id in first loop , in second loop subject id, so that correctly I got 250 records, but my problem is, it stores only first student marks to all students, how to solve that.
Here is my code?
$std_id = $_REQUEST['std_id'];
$sub_id = $_REQUEST['sub_id'];
$sub_mark=$_REQUEST['sub_mark'];
$total=$_REQUEST['total'];
for($i=0;$i<count($std_id);$i++)
{
for($j=0;$j<count($sub_id);$j++)
{
mysql_query("INSERT INTO mark_tbl(std_id,sub_id,mark)VALUES('$std_id[$i]','$sub_id[$j]','$sub_mark[$j]')");
}
}