I want to insert row with values which is shown in the foreach loop, in a table names as exams_record using php.
So, How can I insert the values I am printing in foreach into table exams_record?
<?php
$db_exams = mysqli_connect('localhost','root','','exams');
$sql_query = "SELECT * FROM exam_timing AS et INNER JOIN exam_details AS ed
ON et.exam_id = ed.Id WHERE et.Admin_Id = '$username'";
$ids = mysqli_fetch_all(mysqli_query($db_exams, $sql_query), MYSQLI_ASSOC);
foreach($ids as $id) {
echo $id['id']," ",$id['exam_id']," ",$id['time']," ",$id['date']," ",$id['timeduration'],
" ",$id['max_score']," ",$id['Admin_Id']," ",$id['Id']," ",$id['Name']," ",$id['Course']," ",
$id['Semester']," ",$id['Year'],"<br>";
}
?>
<html>
<body>
<div id ="exams_container">
<table id="exams_record">
<colgroup>
<col span="1" style="width: 80%;">
<col span="6" style="width: 10%;">
</colgroup>
<tr>
<th>Today's Exam</th>
<th>Course</th>
<th>Timing</th>
<th>Date</th>
<th>Year</th>
<th>Semester</th>
<th>Preview</th>
</tr>
</table>
</div>
</body>
</html>