Jump to content

Dynamic list Content Help


sanjayshiwakoti

Recommended Posts

i'm making a hierarchical Order list for this i've created database where

parameter_cd,parameter_desc,upper_parameter_cd

 

my page is like this

 

$Sql="select p.parameter_cd, p.parameter_desc, p.upper_parameter_cd,

level, (select count(*)

from parameter

WHERE parameter_cd <> p.parameter_cd

start with parameter_cd = p.parameter_cd

connect by prior parameter_cd = upper_parameter_cd

and upper_parameter_cd=p.parameter_cd

) no_of_childs

from parameter p

start with upper_parameter_cd is null

connect by prior parameter_cd = upper_parameter_cd";

$objTree=new Sandee;

$objTree->dbQuery($Sql);

 

<ul id="dhtmlgoodies_tree2" class="dhtmlgoodies_tree">

 

<?

$old_value_level=NULL;

$old_upper_cd=NULL;

$counter = 0;

$no_of_childs =array();

$i=0;

while($dataTree=$objTree->dbFetchArray(1)){

 

?>

<li id="node<?=$dataTree['PARAMETER_CD']?>"><a href="#"><?=$dataTree['PARAMETER_DESC']?></a>

<?

if($dataTree['NO_OF_CHILDS']>0){

print "<ul>";

 

 

 

}else if($dataTree['NO_OF_CHILDS']==0){

print "</li>";

}

 

 

if(($no_of_childs == 0 && trim($no_of_childs)!= ''))

print "</ul></li>"; //I know here is the error

//Couln't find the logic

else{

$no_of_childs--;

}

 

?>

<?

 

$old_value_level=$dataTree['LEVEL'];

}

 

 

 

 

 

?>

 

</ul>

 

This is true if there is only up to two child but in multiple child it can't display the data properly Please any sugession

Link to comment
https://forums.phpfreaks.com/topic/41596-dynamic-list-content-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.