D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
alumni
/
application
/
models
/
admin
/
reports
/
Filename :
GeneralReports.php
back
Copy
<?php /** * Description of User * * @author Softpro India Pvt. Ltd. */ class GeneralReports extends CI_Model { //put your code here function getPosts() { $this->db->select("*"); $this->db->from("tbl_post p"); $this->db->join("tbl_stu_alu sa", "p.userid=sa.userid"); $this->db->order_by("datentime", "DESC"); return $this->db->get(); } // function getUsers() { // $this->db->select("*"); // $this->db->from("tbl_stu_alu sa"); // $this->db->join("tbl_course c", "sa.c_id=c.c_id"); // $this->db->order_by("name", "DESC"); // return $this->db->get(); // } function getUsers($name = '', $course = '', $passingYear = '', $startDate = '', $endDate = '', $userType = '') { $this->db->select("*"); $this->db->from("tbl_stu_alu sa"); $this->db->join("tbl_course c", "sa.c_id=c.c_id"); if ($name != '') { $this->db -> where("sa.name like'%". $name."%'"); } if ($course != '') { $this->db -> where("sa.c_id", $course); } if ($passingYear != '') { $this->db -> where("sa.passing_year", $passingYear); } if ($startDate != '' && $endDate!='') { $this->db -> where("sa.date_added BETWEEN '".$startDate."' AND '".$endDate."'"); } if ($startDate == '' && $endDate!='') { $this->db -> where("sa.date_added <= ". $endDate); } if ($startDate != '' && $endDate=='') { $this->db -> where("sa.date_added >= ". $startDate); } if ($userType != '') { $this->db -> where("sa.user_type", $userType); } $this->db->order_by("sa.date_added", "DESC"); return $this->db->get(); } }