Skip to content

Instantly share code, notes, and snippets.

@dmacompton
Created July 9, 2015 08:37
Show Gist options
  • Save dmacompton/b252daa5dfd8da28f1fb to your computer and use it in GitHub Desktop.
Save dmacompton/b252daa5dfd8da28f1fb to your computer and use it in GitHub Desktop.
CI model admin
<?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