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

Creating web pages by php
Hello again,
I was just wondering us there a way to use a php script to create a new web page. I

User information
Hi All,
By using t-code SUIM we get all the user details,if suppose we donot have permission t

adding 0 to numbers
Hey guys i need to create a 00001 number in a loop. Is there a better way of forcing a 5 digit numbe

Filename like the user name
I am creating a form and storing the values in file. Could anyone please tell me how to write a code

Saas with SAP R/3
hi experts,

Is SaaS offer available in SAP? for SAP R/3? from where i can get the info a

PHP & MS Access - Line Break
Hey Guys!

I'm pulling records from an MS Access database and listing them using PHP and I'm r

problems with script
I made a small script wich exchanges points in my website:


<?php
session_start

Opening Multiple Files/Links in Order.
I want to open links in order/one-by-one and check each for a specific string.

Example:
I

need help in creating captcha
hi i have a problem creating captcha system. i create some basic script for image displaying but it

Disable Scrollbar in TableControl
Hello everbody,

please can anybody help me - outherwise i'm going to become desperate :P<

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