Welcome Guest, Not a member yet? Register   Sign In
How can I do this with CodeIgniter
#5

[eluser]egy_programozo[/eluser]
rip_pit's code v1.2
Code:
$this->db->select('blog.*, categories.id as category_id, categories.name as categories_name');
$this->db->from( 'blog' );
$this->db->join( 'categories', 'categories.id = blog.cat_id', 'LEFT');
$this->db->order_by('categories.name ','DESC');
$this->db->order_by('blog.id','DESC');
$query = $this->db->get();

if ($query->num_rows() > 0)
{
  $results = $query->result();
  
  //do what filtering is needed
  $memory = false;
  foreach ($results as $key => $row) {
    if ( $row->categories_name != $memory ){
        $memory = $row->categories_name;
        echo $mermory.'<br>';
    }
    echo ' -> '.$row->name.'<br>';
  }

}
else
{
  echo 'nothing to do here...';
}


Messages In This Thread
How can I do this with CodeIgniter - by El Forum - 10-13-2012, 01:08 PM
How can I do this with CodeIgniter - by El Forum - 10-13-2012, 02:13 PM
How can I do this with CodeIgniter - by El Forum - 10-13-2012, 03:25 PM
How can I do this with CodeIgniter - by El Forum - 10-14-2012, 12:25 PM
How can I do this with CodeIgniter - by El Forum - 10-14-2012, 03:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB