if($num > 0){ <?php $query = "SELECT stu_g.*, stu.student_sex,stu. student_fname, student_lname FROM student_group AS stu_g INNER JOIN student AS stu ON stu_g.student_username = stu.student_username WHERE subject_group_id= '$subject_group_id' ORDER BY student_username ASC " or die("Error:" . mysqli_error()); $result = mysqli_query($con, $query); echo ' <table class="table table-hover">'; echo "<tr> <th>รหัสนิสิต</th> <th>ชื่อ - นามสกุล</th> <th>มา</th> <th>สาย</th> <th>ขาด</th> <th>ลา</th> </tr>"; while($row = mysqli_fetch_array($result)) { $student_username = $row['student_username']; $student_sex = $row['student_sex']; $student_fname = $row['student_fname']; $student_lname = $row['student_lname']; $check_att = " SELECT attendance_status_id FROM check_attendance WHERE attendance_id = '$attendance_id' and student_username = '$student_username'"; $query_att = mysqli_query($con, $check_att) or die(mysqli_error()); $row_att = mysqli_fetch_array($query_att); echo "<tr>"; echo "<td>$student_username</td> "; echo "<td>" .$student_sex .' '.$student_fname .' '.$student_lname."</td> "; ?> <td><input type='radio' <?php if($row_att["attendance_status_id"]=="1")echo" checked";else echo" disabled";?>></td> <td><input type='radio' <?php if($row_att["attendance_status_id"]=="2")echo" checked";else echo" disabled";?>></td> <td><input type='radio' <?php if($row_att["attendance_status_id"]=="3")echo" checked";else echo" disabled";?>></td> <td><input type='radio' <?php if($row_att["attendance_status_id"]=="4")echo" checked";else echo" disabled";?>></td> <?php echo "</tr>"; }
<?php $student=5; for($i=0;$i<=$student;$i++) { $i++; } echo 'Total = '.$i;
mysqli_num_rows()
SELECT COUNT(*) FROM `table` WHERE `column` = 'condition';
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง