displaying unknown amount of results


Posted on 16th Feb 2014 07:03 pm by admin

I am reading a directory and getting a list of folders in the directory, I want to display the folders in a table which is 6 columns of results across by how ever may rows, here is the code I am using now which gets the folders and displays the table correctly, but it is currently only displaying the first result in an infinite loop.

Code: <?php
$d='action'; #define which dir you want to read
Did you know?Explore Trending and Topic pages for more stories like this.
$dir = opendir($d); #open directory
while ($f = readdir($dir)) {
/* echo '<a href="'.$f.'/index.htm" target="_parent"><img src="'.$d.'/'.$f.'/folder.jpg" border="0"></a>
'; */
if ($f!="." && $f!=".." && (!is_file($f))) {
echo '<table cellspacing="5" cellpadding="4" align="center">';
$tdcount = 1;
while ($f) {
if($tdcount % 6 == 1) echo "<tr>";
echo '<td><font face="arial" size="1">';
echo '<a href="'.$f.'/index.htm" target="_parent"><img src="'.$d.'/'.$f.'/folder.jpg" border="0"></a></td>';
if($tdcount % 6 == 0) echo "</tr>";
$tdcount++;
}
echo "</table>";
}
}
?>How do i make it display each result instead of only the first result.
No comments posted yet

Your Answer:

Login to answer
68 Like 38 Dislike
Previous forums Next forums
Other forums

System copy error in RUN ABAP REPORT PHASE
Hi,
I am performing system copy on my test server. I have previously taken export of JAVA + A

Day of week
I am using PHP version 5.0.5
I have a varaible ($DATE (date format yyyy-mm-dd)) that is being inc

how to configure ADS in ABAP instance
Hi All,

I am working on r/3 4.7 ABAP system.Can we configure ADS(adobe document services)

Specific name typed, specific image shown on html page
Hello,

Fairly new to PHP and was curious if someone might know how to solve a fairly simple r

$_POST
Hi, I have 2 seperate php files, and i want my $_POSt["fname"] To go into both of them, Fo

DYNPRO_FIELD_CONVERSION
Hi gurus,

I got a dump when I run one of my program. the dump is described below:

Set Categories
I am creating a submission form for somebody to come in and submit products. These products are sep

Time script, set to my time zone?
I am using this line to get the date and time

Code: $time = date(F." ".d.", &q

Extra fields in main body and php required.
I'm new to PHP so please be gentle. I have a little php script below that works well.
The &quo

Do something every fifth time?
I'm trying to write a loop, but I want it to do something different after every fifth instance. Like

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash