12-05-2016, 01:51 AM
(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]](https://ibin.co/34JIC85bBynS.png)
Example
I have tried
Question How can I get it to properly make the parentlist. Can not seem to return 35, 34, 1 if fid 36
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]](https://ibin.co/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!