Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 10-10-2010, 07:47 PM Need help with php
Novice Talker

Posts: 11
Name: Robert Gouveia
Trades: 0
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
RobbieG is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-10-2010, 08:44 PM Re: Need help with php
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
It looks like you need to move the closing </li> outside of the body of the if statement.

Also using short tags (<?) is a bad habit. It makes your code less portable and they will be deprecated in future versions of PHP.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 10-11-2010, 03:02 AM Re: Need help with php
Novice Talker

Posts: 11
Name: Robert Gouveia
Trades: 0
Quote:
Originally Posted by NullPointer View Post
It looks like you need to move the closing </li> outside of the body of the if statement.

Also using short tags (<?) is a bad habit. It makes your code less portable and they will be deprecated in future versions of PHP.
Thanks for the advice.

I will change the short code now

I will also check if thats what it is
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
RobbieG is offline
Reply With Quote
View Public Profile
 
Old 10-11-2010, 03:43 AM Re: Need help with php
Novice Talker

Posts: 11
Name: Robert Gouveia
Trades: 0
It needed a <li> inside and outside

Also changed to long code rather than short hand.

Thanks
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
RobbieG is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need help with php
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13349 seconds with 12 queries