Welcome Guest, Not a member yet? Register   Sign In
[solved] Making a parentlist of id
#1

(This post was last modified: 12-05-2016, 10:27 PM by wolfgang1983.)

I have a forum table.

I need to make a parent list of all my pids.

Lets say if I need to make parentlist for fid 36 As shown in image below Then then it should return PID numbers only 35, 34, 1 not to return 0 if pid is 0


[Image: 34JIC85bBynS.png]



Example

I have tried


PHP Code:
public function make_parent_list() {

$this->db->where('fid''36');
               
$query 
$this->db->get('forum');
        
$pid_list 
= array();

$pid_list[] = $query->row()->fid;
        
foreach ($query->result() as $category) {
        
$this
->db->where('pid'$category->pid);
            
$query 
$this->db->get('forum');

if (
$query->num_rows() > 0) {

$pid_list[] = $query->row()->pid;

}

}

return 
$pid_list;




Question How can I get it to properly make the parentlist. Can not seem to return 35, 34, 1  if fid 36
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] Making a parentlist of id - by wolfgang1983 - 12-05-2016, 01:51 AM
RE: Making a parentlist of id - by InsiteFX - 12-05-2016, 04:01 AM
RE: Making a parentlist of id - by wolfgang1983 - 12-05-2016, 04:16 AM
RE: Making a parentlist of id - by Wouter60 - 12-05-2016, 08:53 AM
RE: Making a parentlist of id - by wolfgang1983 - 12-05-2016, 08:53 PM
RE: Making a parentlist of id - by Paradinight - 12-05-2016, 09:27 PM
RE: Making a parentlist of id - by wolfgang1983 - 12-05-2016, 10:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB