Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1395 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

(PHP) Fetch from DB then print as list

Thread title: (PHP) Fetch from DB then print as list
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
11-20-2011, 08:31 AM
#2
ExpertsGuide is offline ExpertsGuide
Status: I'm new around here
Join date: Nov 2011
Location:
Expertise:
Software:
 
Posts: 3
iTrader: 0 / 0%
 

ExpertsGuide is on a distinguished road

  Old

You are printing outside the foreach loop.
Try this,

PHP Code:
<?php 
    $child 
getChild(); 
    echo 
"\n<ul>\n" 
        foreach (
$child as $childcat) { 
            
$cat_id $childcat['cat_id']; 
            
$cat_name $childcat['cat_name']; 
            
$url $_SERVER['PHP_SELF'] . "?c=$cat_id"
            echo 
"<li><a href=\"" $_SERVER['PHP_SELF'] . "?c=$cat_id"\">$cat_name</a></li>\n";
        }  
    echo 
"</ul>" 
?>

     


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed