Created
February 19, 2012 22:33
-
-
Save Relequestual/1866240 to your computer and use it in GitHub Desktop.
CodeIgniter blog_model pisyek tut
This file contains hidden or 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 | |
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Blog_model extends CI_Model { | |
function __construct() { | |
parent::__construct(); | |
//var_dump(get_instance()); exit; | |
// $CI = get_instance(); | |
// $CI->load->database(); | |
//$this->load->libray('email'); | |
} | |
function get_all_posts() { | |
$CI = get_instance(); | |
$CI->load->database(); | |
//$query = $this->db->get('entry'); | |
$query = $CI->db->get('entry'); | |
return $query->result(); | |
} | |
function add_new_entry($name,$body) { | |
$data = array( | |
'entry_name' => $name, | |
'entry_body' => $body | |
); | |
$this->db->insert('entry', $data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment