Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- */
- class mahasiswa
- {
- private $conn;
- function __construct()
- {
- $this->conn = new mysqli('localhost','root','','siketek');
- if($this->conn){
- return $this->conn;
- }
- return "DATABASE_CONNECTION_FAILED";
- }
- public function detailHadir($id, $day){
- $sql = "SELECT h.id_hadir, h.tanggal_hadir, h.mulai_hadir, h.selesai_hadir, h.istirahat_hadir, h.sts_hadir FROM hadir h
- JOIN detail_hadir d ON d.id_hadir=h.id_hadir
- JOIN mahasiswa m ON m.id_maha=h.id_maha
- JOIN user u ON u.id_user=m.id_user
- WHERE u.id_user = ? AND WEEK(tanggal_hadir) = ? GROUP BY d.id_hadir ORDER BY tanggal_hadir ASC";
- $pre_stmt = $this->conn->prepare($sql);
- for ($i=0; $i < count($day) ; $i++) {
- $pre_stmt->bind_param('is', $id, $day[$i]);
- $pre_stmt->execute();
- $result = $pre_stmt->get_result() or die($this->conn->error);
- while($row = $result->fetch_assoc()){
- $rows[] = $row;
- }
- }
- return $rows;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement