Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- */
- class Model_input extends CI_Model
- {
- function __construct()
- {
- parent::__construct();
- return $this->db->get('data_tamu');
- }
- public function insert($data,$table)
- {
- /*$data = array(
- 'nama' => $this->input->post('nama'),
- 'instansi' => $this->input->post('instansi'),
- 'alamat' => $this->input->post('alamat'),
- 'peg_ditemui' => $this->input->post('peg_ditemui'),
- 'ket' => $this->input->post('ket')
- );
- $this->db->insert('data_tamu', $data);
- $id = $this->db->insert_id();
- return (isset($id)) ? $id : FALSE;*/
- $this->db->insert($table,$data);
- $id=$this->db->insert_id();
- if($table=='data_tamu'){
- //==========UPDATE============
- $data=array(
- 'waktu' => 123,
- 'tanggal' => 456
- );
- $where="id_tamu='$id'";
- $str = $this->db->update_string($table, $data, $where);
- $str = str_replace("123","CURTIME()",$str);
- $str = str_replace("456","CURDATE()",$str);
- $this->db->query($str);
- //die($str);
- $this->db->reset_query();
- $this->db->where("id_tamu",$id);
- $data=$this->db->get($table)->result();
- //die("id=".$id."<pre>".print_r($data,1));
- }
- return $id;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement