NameSilo

Not sure what problem is

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
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
Close
can you list the whole php file?
 
0
Close
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
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back