Ignore:
Timestamp:
Nov 3, 2014 11:06:12 AM (11 years ago)
Author:
quyenla
Message:

collaborator order sourcecode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php

    r373 r374  
    4646    function countCollaborator($data) {
    4747        $sql = "SELECT COUNT(id) as total FROM " . $this->table_name;
    48         if (isset($data['keyword'])) {
    49             $sql.=" WHERE (full_name LIKE '%" . $data['keyword'] . "%' OR login_name LIKE '%" . $data['keyword'] . "%') ";
     48        if ($data['keyword']) {
     49            if ($data['search_field'] == "cellphone") {
     50                $sql.=" WHERE (cellphone LIKE '%" . $data['keyword'] . "%')";
     51            } else {
     52                $sql.=" WHERE (full_name LIKE '%" . $data['keyword'] . "%' OR login_name LIKE '%" . $data['keyword'] . "%') ";
     53            }
    5054        }
    51 
     55        if (isset($this->db->query($sql)->row_array()['total']))
     56        {
    5257        return $this->db->query($sql)->row_array()['total'];
     58        }
     59        else
     60        {
     61            return 0;
     62        }
    5363    }
    5464
Note: See TracChangeset for help on using the changeset viewer.