我有名为的表subject
。我有列id
(PK) 、、、、subject_name
和( FK)。我的用户填写表格并提交。我通过表单的 post 方法获得了值。在表格中,我有 6 个科目,对于每个科目,我都有, , . 这是我的代码total_class
attendence
cnic
total_class
attendence
subject_name
if($_SERVER['REQUEST_METHOD']=='POST')
{
$form=$_POST[form'];
$s1=$_POST['sub1'];
$s1=$_POST['sub2'];
$s1=$_POST['sub3'];
$s1=$_POST['sub4'];
$s1=$_POST['sub5'];
$s1=$_POST['sub6'];
$month=$_POST['month'];
$total_attend_1=$_POST['Ts1'];
$total_attend_2=$_POST['Ts2'];
$total_attend_3=$_POST['Ts3'];
$total_attend_4=$_POST['Ts4'];
$total_attend_5=$_POST['Ts5'];
$total_attend_6=$_POST['Ts6'];
$attend_1=$_POST['Attend_s1'];
$attend_2=$_POST['Attend_s2'];
$attend_3=$_POST['Attend_s3'];
$attend_4=$_POST['Attend_s4'];
$attend_5=$_POST['Attend_s5'];
$attend_6=$_POST['Attend_s6'];
$query=mysql_query("INSERT INTO subject VALUE( '','$s1','total_attend_1','$attend_1','$form','$month')") or die(mysql_error());
/*My query should be here.Should I write 6 insert queries?*/
我曾尝试过使用
foreach($array as $attendee){
}
但没有得到我的任务?有人可以帮帮我吗?