<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class enquiry_model extends CI_Model {

    var $tableName = 'tbl_contact_us';

    function insertNewEnquiry() {
        if ($this->input->post('full_name'))
            $this->db->set('full_name', $this->input->post('full_name'));
        if ($this->input->post('phone_no'))
            $this->db->set('phone_no', $this->input->post('phone_no'));
        if ($this->input->post('email_id'))
            $this->db->set('email_id', $this->input->post('email_id'));
        if ($this->input->post('order_no'))
            $this->db->set('order_no', $this->input->post('order_no'));       
        if ($this->input->post('location_id'))
            $this->db->set('location_id', $this->input->post('location_id'));       
        if ($this->input->post('message'))
            $this->db->set('message', $this->input->post('message'));
     
        $this->db->set('read_status','unread');
        $this->db->set('add_time', time());
        $query = $this->db->insert($this->tableName);
        $response = $this->db->insert_id();
        return $this->db->insert_id();
    }

}