Hello All
I have a table containing menuid,menuname,parentid in the table.
menuid menuname parentid
1 programs of study 0
2 adult education 1
3 advanced standing 1
0=> means is its a root menu
2=> means it is referencing menu id (ie.,EFG is to be displayed under BCD)
like wise as i have inserted the image below contains an image before adult education and advanced standing means they are child rows of programs of study.
please go through my code it displays programs of study only not displaying the adult education and advanced standing. please correct my code.
Thanks in advance
<?php
if(isset($_GET['module']) && $_GET['module']=='insert')
{
echo "Record Added Succesfully";
}
?>
<?php
if(isset($_GET['module']) && $_GET['module']=='update')
{
echo "Record Updated Successfully";
}
?>
<?php
if(!empty($_SESSION['message'])) echo $_SESSION['message']; $_SESSION['message'] = '';
$DisplayQuery1="select menu_id,menu_name,parent_id, content_type,active_status from tbl_watc_menu where delete_status=0 ";
$result1=mysql_query($DisplayQuery1);
$nume = mysql_num_rows($result1);
while ($row = mysql_fetch_array($result1))
{
$parent_id=$row[2];
$menuid=$row[0]; //echo $menuid."<br>";
}
$DisplayQuery="select menu_id,menu_name,parent_id,content_type,active_status,delete_status from tbl_watc_menu where menu_id=".$parent_id;
// echo $DisplayQuery; die;
// echo $DisplayQuery; die;
$result=mysql_query($DisplayQuery);
$nume = mysql_num_rows($result);
// $DisplayQuery .= " limit $eu,$limit";
$result1=mysql_query($DisplayQuery);
if( $nume < 1)
{
echo "NO RECORDS FOUND";
}
else
{
?>
<?php
echo '<table width="100%" height="31" border="0" cellpadding="0" cellspacing="0">';
while ($row = mysql_fetch_array($result1))
{
$parent_id=$row[2];
$menuid=$row[0]; //echo $menuid."<br>";
/* if($parent_id !=0)
{
echo '<img src="images/arrow_small.gif">'.$row[1];
echo $parent_id."SAIGOPAL PUT DIE AFTER THIS"; die;
} */
echo '<tr>';
echo '<th width="29%" height="22" scope="col" align="left">';
echo substr($row[1],0,100);
echo '</th>';?>
<th width="33%" scope="col">
<?php
//echo $row[2];
if($row[3]=='c')
{
$content='<a href="fck.php">Content</a>';
}
else if($row[3] =='f')
{
$content='<a href="fileupload.php">File</a>';
}
else if($row[3] =='b')
{
$content='Blank';
}
else if($row[3] =='l')
{
$content='<a href="url.php">URL</a>';
}
echo $content; ?>
</th>
<th width="9%" scope="col"><a href="editmenu.php"><?php echo "Edit"; ?></a></th>
<th width="14%" scope="col">Delete</th>
<th width="15%" scope="col">Active</th>
</tr>
<?php }}?>