Created
July 9, 2015 08:37
-
-
Save dmacompton/b252daa5dfd8da28f1fb to your computer and use it in GitHub Desktop.
CI model admin
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 | |
class Model_admin extends CI_Model { | |
// UPDATE | |
function updateTable($table, $dbins, $where=FALSE) { | |
if($where) | |
$this->db->update($table, $dbins, $where); | |
else | |
$this->db->insert($table, $dbins); | |
} | |
// REMOVE | |
function removeFromTable($table, $where=FALSE){ | |
if($where) | |
$this->db->where($where)->delete($table); | |
else | |
$this->db->empty_table($table); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment