Skip to content

Instantly share code, notes, and snippets.

@felixmc
Last active December 29, 2015 16:29
Show Gist options
  • Save felixmc/7697468 to your computer and use it in GitHub Desktop.
Save felixmc/7697468 to your computer and use it in GitHub Desktop.
simple code igniter model for a
<?php
class Static_Page_Model extends CI_Model {
function __construct() {
// Call the Model constructor
parent::__construct();
}
public function createPage ($data) {
$data['date_created'] = date('Y-m-d H:i:s');
$this->db->insert("pages", $data);
}
public function getPage ($slug) {
$this->db->where("slug", $slug);
return $this->db->get("pages")->row_array();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment