Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_records($table, $where=NULL)
- {
- if(!empty($where))
- {
- $this->db->where($where);
- }
- $query=$this->db->get($table);
- if($query->num_rows>0)
- {
- return $query->result();
- }
- else
- {
- return array();
- }
- function get_record($table, $where=NULL)
- {
- if(!empty($where))
- {
- $this->db->where($where);
- }
- $query=$this->db->get($table);
- if($query->num_rows>0)
- {
- return $query->row();
- }
- else
- {
- return 0;
- }
- }
- function update($table ,$where=NULL ,$data)
- {
- if(!empty($where))
- {
- $this->db->where($where);
- }
- $query=$this->db->update($table,$data);
- if($query)
- {
- return $this->db->affected_rows();
- }
- }
- function delete($table , $where=NULL)
- {
- if(!empty($where))
- {
- $this->db->where($where);
- }
- if($this->db->delete($table))
- {
- return $this->db->affected_rows();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement