我们有一个表格,其中包含学生被分配到的所有课程和级别。 此表名为' tbl_assignedclass '包含studentID,programID,levelID和semesterID
我需要在完成三个学期的相同课程和水平后显示学生的统计数据,如果他再学习不同的课程和水平,则需要再次显示。
<?php
$query="SELECT * FROM `tbl_assignedclass` where student_id ='1' ";
$result_assign = $conn->query($query);
while($row_assign = $result_assign->fetch_assoc())
{
?>
//I want to display the following data
<div>
statistics for studentID,<br />
Semester Name - Program Name - level Name <br>
</div>
<?php }
?>
答案 0 :(得分:0)
<?php
$display = '';
$dbc = mysqli_connect("", "", "", "");
if (mysqli_connect_errno()) {
echo mysqli_connect_error();
exit();
}
$query = "SELECT * FROM tbl_assignedclass WHERE student_id='1'";
$result = mysqli_query($dbc, $query);
if($result){
while($row = mysqli_fetch_assoc($result)){
$id = $row['id'];
$name = $row['name'];
$email = $row['email'];
$display .= 'ID: '.$id.' NAME: '.$name.' EMAIL: '.$email.'<br>';
}
}else{$display = 'NO RESULTS';}
echo $display;
?>