Skip to content

Instantly share code, notes, and snippets.

@dmacompton
Created July 9, 2015 08:37
Show Gist options
  • Select an option

  • Save dmacompton/b252daa5dfd8da28f1fb to your computer and use it in GitHub Desktop.

Select an option

Save dmacompton/b252daa5dfd8da28f1fb to your computer and use it in GitHub Desktop.

Revisions

  1. dmacompton created this gist Jul 9, 2015.
    20 changes: 20 additions & 0 deletions model_admin.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    <?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);
    }
    }
    ?>