Skip to content

Instantly share code, notes, and snippets.

@Tjoosten
Created August 6, 2014 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tjoosten/73260fbb675a656505da to your computer and use it in GitHub Desktop.
Save Tjoosten/73260fbb675a656505da to your computer and use it in GitHub Desktop.
<?php
// ______________________
// / \
// | WARNING: |
// | Here will be dragons |
// \___ _________________/
// |/
// (o_
// //\
// V_/_
// ================================
class model_CRUD extends CI_model {
public function Read() {
$query = $this->db->get('Persons');
return $query->result();;
}
public function Read_Person() {
$this->db->select();
$this->db->where('ID', $this->uri->segment(3));
$Query = $this->db->get('Persons');
return $Query->result();
}
public function InsertDB() {
$Values = array(
'Firstname' => $this->input->post('Firstname'),
'Lastname' => $this->input->post('Lastname')
);
$this->db->insert('Persons', $Values);
}
public function UpdateDB() {
$Values = array(
'Firstname' => $this->input->post('Firstname'),
'Lastname' => $this->input->post('Lastname')
);
$this->db->update('Persons', $Values);
$this->db->where('ID', $this->uri->segment(3));
}
public function DeleteDB() {
$this->db->where('ID', $this->uri->segment(3));
$this->db->delete('Persons');
}
}
// There were no dragons slayered bij writing this code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment