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

(12-05-2016, 08:53 PM)wolfgang1983 Wrote: I now have tried this

PHP Code:
public function make_parent_list($fid) {

$sql "SELECT * FROM forum WHERE fid  = '" $fid "'"
 
  
$query 
$this->db->query($sql);

$arr = array();
 
  
foreach ($query->result() as $row) {

if (
$row->pid) {

$arr[] = $row->pid;

$arr[] = $this->make_parent_list($row->pid);

}
 
  
}

return 
$arr;



But the implode throws error here

Code:
A PHP Error was encountered
Severity: Warning
Message: implode(): Invalid arguments passed
Filename: forums/Forum_management.php

Echo out put is 34,Array


PHP Code:
$results $this->make_parent_list('36');

foreach (
$results as $result) {
echo 
implode(','$result);

PHP Code:
string implode string $glue , array $pieces 

1. $result is a int or an array
2. you forgot to escape $fid
3. http://stackoverflow.com/questions/29384...cture-list
Reply


Messages In This Thread
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