Welcome Guest, Not a member yet? Register   Sign In
[Solved] GROUP CONCAT not work correct
#1

(This post was last modified: 09-25-2015, 11:46 PM by wolfgang1983.)

On my categories project I am trying a new method for my categories list.

My GROUP_CONCAT not working for some reason my sub category name not showing correct but it is going to the correct page when I click on edit button just the name not printing out correct.

I have attached image of what it looks like at the moment. The links are correct and every thing else just name having issue

Currently what's showing


  1. Example
  2. Example
  3. Example
  4. PHP
  5. PHP

It should produce like this below

  1. Example
  2. Example > Some Example 1
  3. Example > Some Example 2
  4. PHP
  5. PHP > Functions

Model

PHP Code:
public function get_categories() {
    $language_id '1';

    $this->db->select('cp.category_id AS category_id, GROUP_CONCAT(cd1.name SEPARATOR "  >  ") as name');
    
    $this
->db->from('category_path cp''LEFT');
 
   
    
// Parent Cat
    $this->db->join('category c1''c1.category_id = cp.category_id''LEFT');

 
   // Sub Cat
    $this->db->join('category c2''c2.category_id = cp.path_id''LEFT');

 
   // Parent Cat Desc
    $this->db->join('category_description cd1''cd1.category_id = cp.path_id''LEFT');

 
   // Sub Cat Desc
    $this->db->join('category_description cd2''cd2.category_id = cp.category_id''LEFT');

    $this->db->group_by('cp.category_id');
    $this->db->order_by('name''ASC');
    $this->db->where('cd1.language_id', (int)$language_id);
    $this->db->where('cd2.language_id', (int)$language_id);
    $query $this->db->get();
    return $query->result_array();




Any thing I am doing wrong please can you share examples thanks in advance.

Attached Files Thumbnail(s)
   
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
[Solved] GROUP CONCAT not work correct - by wolfgang1983 - 09-22-2015, 11:42 PM
RE: GROUP CONCAT not work correct - by mwhitney - 09-23-2015, 08:41 AM
RE: GROUP CONCAT not work correct - by Martin7483 - 09-24-2015, 12:33 AM
RE: GROUP CONCAT not work correct - by mwhitney - 09-24-2015, 06:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB