for() question
| From: | Chris Blake | Date: | Tue, 29 Apr 2003 09:12:12 +0000 |
| Subject: | for() question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-145600@lists.php.net to get a copy of this message | ||
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.