Jump to content

Nested While loop not works


vinoindiamca

Recommended Posts

Nested While loop not working in IE but works perfect in Firefox

 

i used tree view to list out my main category ,sub category and sub-sub category

like

Art (Main Category)

  |-Drawing(Sub Category)

  |-Painting

            |-Brush(Sub-Sub Category)

            |-Colors

 

<?php

include_once("../includes/connect.php");

$select = "select * from maincat ";

$res = mysql_query($select);

$rec_count = mysql_num_rows($res);

 

 

 

?>

 

 

 

<div id="sidetree">

<div class="treeheader"> </div>

<div id="sidetreecontrol"><a href="?#">Collapse All</a> | <a href="?#">Expand All</a></div>

<?php

while($row=mysql_fetch_assoc($res))

  {

$mid=$row["mainid"];   

$mname=$row['catname'];

?>

<ul id="tree"><li>

<strong>

<a href="admin_mcatedit.php?cid=<?php echo $mid;?>"><?php echo $mname;  ?></a>

</strong>

 

<ul>

<?php

$select1 = "select * from subcat where mainid='$mid' ";

$res1 = mysql_query($select1);

 

while($row1=mysql_fetch_assoc($res1))

{

$sid=$row1["subid"];

$subname=$row1['subcatname'];

?>

<li><a href="admin_mcatedit.php?cid=<?php echo $sid;?>"><?php echo $subname;  ?></a>

<ul>

<?php

$select2 = "select * from subsubcat where mainid='$mid' and subid='$sid' ";

$res2 = mysql_query($select2);

 

while($row2=mysql_fetch_assoc($res2))

{

$ssid=$row12["subsubid"];

$ssubname=$row2['subsubcatname'];

?>

<li><a href="admin_mcatedit.php?cid=<?php echo $ssid;?>"><?php echo $ssubname;  ?></a></li>

<?php

}

?>

</ul>

</li>

<?php

}

?>

 

 

</ul>

</li> <?php

}

?>

</ul>

 

</div>

 

Please help me

 

Link to comment
https://forums.phpfreaks.com/topic/145876-nested-while-loop-not-works/
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.