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
$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

Not adding to db
Hi, I can't figure out why it won't add the record to the database. It's just a simple form to get

Need help making a script that moves data into acrhive table
Hi,

I'm kinda new to php/mysql

And i wrote a simple script to store sales lead for a b

how to insert value
I am having file bookissueadd.php..... in which i am having tag

<td height="21&q

isset undefined variable
Hi all,

Hope someone can point out the obvious. I've a log in script, if you dont enter a use

PRotect my POST DATA... FROM HTML ATTACKS
I need to like let's say

If a user submit's his Prayer and he put's <meta refresh stuf

Need PHP help... have all the elements... just need help putting them together :
Hey Guys,

I was wondering if someone could help me. I am doing a website for a client which

Legal Issues for SAP ERP o ERP in general
Hi experts,

Can someone please help me finding some documentation about legal issues tha

Help to integrate whois Domain Details to website
Hi,

can i know is their any php script r methods to add domain details to my website.

fopen() security
As i understood the usage of fopen() for it to function correctly the Dir you write to has to be rw

dropdown menu
Hello everbody,

I am php newbie.
I need to develop a program that once click the drop do

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