-
-
Save Tjoosten/73260fbb675a656505da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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