BBnepal-Accounts/application/models/Transport_model.php

60 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2024-07-10 12:43:19 +00:00
<?php
class Transport_model extends CI_Model{
public function __construct()
{
$this->load->database();
}
public function login($uname, $pwd)
{
$pwd = md5($pwd);
$sql = $this->db->query("SELECT * FROM admin WHERE email='$uname' AND password='$pwd' AND admin_role_ids=5");
if ($sql->num_rows() > 0) {
return $sql->row_object();
} else {
return false;
}
}
public function getSingleData($table, $where)
{
$this->db->where($where);
return $this->db->get($table)->row_array();
}
public function insertData($checkInOutData){
$this->db->insert('checkin_checkout', $checkInOutData);
if($this->db->affected_rows() > 0){
return $this->db->insert_id();
}
else{
return false;
}
}
public function getData($table, $where)
{
if($table == 'course'){
$this->db->order_by('id', 'ASC');
}
if($where!='')
{
$this->db->where($where);
}
return $this->db->get($table)->result_array();
}
public function getDataGroupBy($today, $sid)
{
$condition = "";
if($sid!=""){
$condition = " AND student_id IN ('$sid')";
}
$select = $this->db->query("SELECT count(id) as ttl FROM checkin_checkout WHERE DATE(date)='$today' $condition GROUP BY student_id");
$query = count($select->result_array());
return $query;
}
}
?>