Hi i have coded a navigation so that it can have a sister level.
But unfortunately it doesnt close the <li> if there is no sister level so it looks like this
HTML Code:
<ul>
<li><a href="'">test link</a>
</ul>
Could someone help me solve this...
The actuall code is here:
PHP Code:
<ul>
<?php
//$query="SELECT * FROM staticpage";
//$res = mysql_query($query,$db);
//$row1 = mysql_fetch_array($res);
$query = "select * from staticpage where parent_id=0";
$res=mysql_query($query);
while($row = mysql_fetch_array($res))
{
?>
<li><a href="<?php echo str_replace(" ", "-", strtolower($row['non_edit_name']))?>.php" title="<?php echo $row['name']?>"><?php echo $row['name']?></a>
<?php
$pqry="SELECT * FROM staticpage WHERE parent_id=".$row['id'];
$resp=mysql_query($pqry);
if(mysql_num_rows($resp) >0)
{
?>
<ul>
<?
while($rowp = mysql_fetch_array($resp))
{
?>
<li><a href="<?php echo str_replace(" ", "-", strtolower($rowp['non_edit_name']))?>.php" title="<?php echo $row['name']?>"><?php echo $rowp['name']?></a></li>
<?
}
?>
</ul>
</li>
<?
}
}
?>
</ul>
Thanks in advance
|