NameSilo

Not sure what problem is

Spaceship Spaceship
Watch

skrilla

VIP Member
Impact
11
http://www.orangeinteractivehosting.com/Tester/

My bulleted list of categories being called from my database isnt showing the last link.. if I add another category it will show the 3rd but not the 4th.. etc etc.. anyone know what im doing wrong?

Here is my code:

HTML:
<div style="position:relative; left: 40px; top: 10px; width: 159px; overflow:inherit; z-index: 200;">
			<p id="navhead">CATEGORIES</p>
                  <ul class="navlist">
				<?php 
				for($i=0;$i<count($catArray);$i++):?>
                	<li class="navitem">
						<a href="index.php?cat=<?=$catArray[$i]?>"><?=$catArray[$i]?></a></li>
<?php endfor; ?>
</ul>
<br><br>
<?
include("xxx");
$sql = "SELECT * FROM content WHERE content_id = '5'";
$result = mysql_query($sql);
$data = mysql_fetch_array($result);
echo"
<div class= 'links'>
$data[content_text]
</div>
";
?></div>
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Is it the code? If so, what is $catArray (your previous SQL query ?).
PHP:
<?php for($i=0;$i<count($catArray);$i++): ?>
<li class="navitem"> <a href="index.php?cat=<?=$catArray[$i]?>"><?=$catArray[$i]?></a></li>
<?php endfor; ?>
 
0
•••
If its always just missing the last item try changing this line:

<?php for($i=0;$i<count($catArray);$i++): ?>

to:
<?php for($i=0;$i<=count($catArray);$i++): ?>


will make it do it one more time than it currently is... if thats the only issue
 
0
•••
can you list the whole php file?
 
0
•••
NVD said:
If its always just missing the last item try changing this line:

<?php for($i=0;$i<count($catArray);$i++): ?>

to:
<?php for($i=0;$i<=count($catArray);$i++): ?>


will make it do it one more time than it currently is... if thats the only issue
thats right :tu:
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back