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

class Model_why_choose extends CI_Model 
{

	function get_auto_increment_id()
    {
        $sql = "SHOW TABLE STATUS LIKE 'tbl_why_choose'";
        $query = $this->db->query($sql);
        return $query->result_array();
    }
	
    function show() {
        $sql = "SELECT * FROM tbl_why_choose ORDER BY id ASC";
        $query = $this->db->query($sql);
        return $query->result_array();
    }

    function add($data) {
        $this->db->insert('tbl_why_choose',$data);
        return $this->db->insert_id();
    }

    function update($id,$data) {
        $this->db->where('id',$id);
        $this->db->update('tbl_why_choose',$data);
    }

    function delete($id)
    {
        $this->db->where('id',$id);
        $this->db->delete('tbl_why_choose');
    }

    function getData($id)
    {
        $sql = 'SELECT * FROM tbl_why_choose WHERE id=?';
        $query = $this->db->query($sql,array($id));
        return $query->first_row('array');
    }

    function why_choose_check($id)
    {
        $sql = 'SELECT * FROM tbl_why_choose WHERE id=?';
        $query = $this->db->query($sql,array($id));
        return $query->first_row('array');
    }

    function get_photo()
    {
        $sql = 'SELECT * FROM tbl_why_choose_photo WHERE id=?';
        $query = $this->db->query($sql,array(1));
        return $query->first_row('array');
    }
    function update_why_choose_photo($data) {
        $this->db->where('id',1);
        $this->db->update('tbl_why_choose_photo',$data);
    }
    
}