Ignore:
Timestamp:
Nov 3, 2014 12:25:15 PM (11 years ago)
Author:
namnd
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/core/MY_Model.php

    r337 r375  
    3030        {
    3131                $this->db->select('*')->from($this->table_name)->where($this->id_name, $id);
    32                 $query = $this->get();
     32                $query = $this->db->get();
    3333                if($query->num_rows() > 0)
    3434                {
    3535                        $row = $query->row_array();
    36                         return $rows;
     36                        return $row;
    3737                }
    3838        }
     
    4343                return $query->result();
    4444        }
     45       
     46        function check_exist($data)
     47        {
     48                $sql="SELECT COUNT(".$this->id_name.") as total FROM ".$this->table_name." WHERE ".$data['field']." = '".$data['value']."' LIMIT 1";
     49                if ($this->db->query($sql)->row_array()['total']==1)
     50                {
     51                        return true;
     52                }
     53                else
     54                {
     55                        return false;
     56                }
     57        }
    4558}
Note: See TracChangeset for help on using the changeset viewer.