Skip to content

Instantly share code, notes, and snippets.

@arvindravi
Created July 9, 2011 10:41
Show Gist options
  • Save arvindravi/1073496 to your computer and use it in GitHub Desktop.
Save arvindravi/1073496 to your computer and use it in GitHub Desktop.
My Model
<?php
class Retindpost extends CI_Model{
function __construct(){
parent::__construct();
}
public function ret_ind_post($id)
{
$this->load->database();
$sql=$this->db->get_where('posts',array('id'=>$id));
return $sql->result();
}
public function get_comments()
{
$comments=$this->db->join('posts','comments.id=posts.id')->select('content')->from('comments')->where('comments.parent_id =','posts.id')->get();
$comments->result();
return $comments;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment