It is the student_info table
CREATE TABLE student_info
(
s_id varchar(50) NOT NULL,
c_id varchar(50) ,
sem_no varchar(50),
quiz_mark varchar(50) ,
att_mark varchar(50),
total_mark varchar(50),
exam_mark varchar(50),
grade varchar(50),
);
insert into student_info values('0006','chem1115','1','15','9',' ','59 ',' ');
insert into student_info values('0006','cse101','1','15','9',' ','70 ',' ');
insert into student_info values('0006','cse111','1','15','9',' ','49 ',' ');
then i run these lines of code
$sql2 = "SELECT c_id, quiz_mark, att_mark,exam_mark FROM student_info WHERE sem_no=$sem AND s_id = $s_id ";
if($query_run = mysql_query($sql2)) {
echo " <table border='1' >
<tr>
<th>Course-no.</th>
<th>quiz mark</th>
<th>att mark</th>
<th>exam mark</th>
<th>total mark</th>
<th>Grade</th>
</tr>";
while ($row1 = mysql_fetch_array($query_run)){
$c_nam = $row1['c_id'];
$quiz_mark = $row1['quiz_mark'];
$att_mark = $row1['att_mark'];
$exam_mark=$row1['exam_mark'];
$total_mark= $att_mark+$exam_mark+$quiz_mark;
$grade=grade($total_mark);
$sql3="UPDATE student_info SET total_mark=$total_mark WHERE c_id=$c_nam";
if(mysql_query($sql3)){
}else {
echo mysql_error();
}
echo "<tr>";
echo "<td>" .$c_nam. "</td>";
echo "<td>" .$quiz_mark. "</td>";
echo "<td>" .$att_mark. "</td>";
echo "<td>".$exam_mark."</td>";
echo "<td>".$total_mark."</td>";
echo "<td>".$grade."</td>";
echo "</tr>";
}
echo "</table> ";
}
else{
echo mysql_error();
}
it is not working. I just can't upadte under a while loop !!
result:
Unknown column 'chem1115' in 'where clause'Unknown column 'cse101' in 'where clause'Unknown column 'cse111' in 'where clause'
chem1115 15 9 59 83 A+
cse101 15 9 70 94 A+
cse111 15 9 49 73 A-
the total_mark feild is not updated on the Database this is the problem !!