<?php 
defined('BASEPATH') OR exit('No direct script access allowed');

class NotificationModel extends CI_Model { 

    public function __construct(){
		parent::__construct();
		$this->load->database();
	}
	
	function get_rows($where)
    {
		$sql = "select * from notification_tb".$where;
		$query = $this->db->query($sql);
		return $query->result_array();
	}

	public function insert_row($insert_data)
	{
		$this->db->insert('notification_tb', $insert_data);
	}

	function delete_row($edit_id)
    {		
		$this->db->delete('notification_tb', array('id' => $edit_id));
	}
	
	function get_row($id)
    {
		$sql = "select * from notification_tb where id = '".$id."'";
		$query = $this->db->query($sql);
		return $query->row_array();
	}

	public function update_row($update_data, $id)
	{
		$this->db->update('notification_tb', $update_data, $id);
	}	

	function get_count($where)
    {
		$sql = "select count(id) as cnt from notification_tb".$where;
		$query = $this->db->query($sql);
		$row = $query->row_array();
		if(isset($row["cnt"]))
			return $row["cnt"];
		else
			return 0;
	}
}