Re: for() question

From: Date: Tue, 29 Apr 2003 09:34:38 +0000
Subject: Re: for() question
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-145609@lists.php.net to get a copy of this message
Howdy Jason, I have tried that already, but all my array elements are ending up in one string.... Here`s my HTML output : --------------------------------------------------- <html> <head> <title>Content Pane</title> </head> <body> <table border="1" bordercolor="navy"> <tr bgcolor="lightgrey"> <td>Main Menu</td> </tr> <tr> <td>Home Products Contact Us Feedback end </td> </tr> </table> </body> </html> ------------------------------------------------------- It should create a new <TR> for each entry found.... Thanks On Tue, 2003-04-29 at 11:25, Jason k Larson wrote: > for starters you are counting an integer. > > $number_of_dirs = count($dir_list); > $i< count($number_of_dirs); > > I think you meant to do, but I dunno: > $i< $number_of_dirs; > > -- > Jason k Larson > > > Chris Blake wrote: > > Greetigns learned PHP(eople), > > > > Why is this code only returning one value to my <td> ? > > directories.txt contains 10 entries. > > > > ----------------------------------------------------------- > > <?php > > $dir_list = file("directories.txt"); > > $number_of_dirs = count($dir_list); > > > > if (!$dir_list) > > { > > print '<p>' . "\n" . '<strong>Directory File > > Not Found.</strong>' > > . "\n" . '</p>'; > > exit; > > } > > > > print "\n" . '<table border="1" > > bordercolor="navy">' . "\n"; > > print '<tr bgcolor="lightgrey">' . "\n"; > > print ' <td>Main Menu</td>' . "\n"; > > print '</tr>' . "\n\n"; > > > > for ($i = 0; $i< count($number_of_dirs); $i++) > > { > > //Get each line in text file and place in an array > > $line = explode( "\t", $dir_list[$i]); > > print '<tr>' . "\n"; > > print ' <td>' . ($line[$i]) . '</td>' . > > "\n"; > > print '</tr>' . "\n\n"; > > } > > > > print '</table>' . "\n"; > > ?> > > ---------------------------------------------- > > > > This is probably just a small oversight on my behalf but it`s driving me > > closer to the bottle of Jack Daniels I have nearby. > > > > Thanks > -- Chris Blake Office : (011) 782-0840 Cell : 083 985 0379 Computers are a lot like air-conditioners. Once you open windows, they stop working properly.

« previous php.general (#145609) next »