line breaks in between fetched file names


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

Hi,

I have this code:
Code: <?php
Did you know?Explore Trending and Topic pages for more stories like this.
if($dir = opendir('files')){
while (($file = readdir($dir) )!== false){
if ($file !='.' && $file !='..'){
echo '<a href="' . $file . '">' . $file . '</a>';"n";

}
}
closedir($dir);
}
?>
but when it outputs the files from the files folder, it lists them one after another with no spaces etc. How can I make it list one file per line?

e.g.
file_1.doc
file_2.png
file_3.exe

Thanks
No comments posted yet

Your Answer:

Login to answer
176 Like 40 Dislike
Previous forums Next forums
Other forums

parse error
On my local machine I keep getting parse error for my footer. When I put it online, it doesn't show

Need help Updating SQL Server Express DB from c# :(
Please can anyone help with:-
1 How to sructure the strSelect statement.
2 How to instruct

Using CSS to format MySQL query
Hi,

If i want to have a news page on my site, which displays all records of a table in descen

Display last record first.
I need some help how put the last record first and first record last.

Thanks

Code: &am

Reg Ex
Im trying to search for the string: srv_9 (Dead ???)

I thought to use preg_match, however I d

get multiple rows
Hi I want to get multiple rows from a db

I am using this for the db query
Code: public

header redirect problems? please help
Ok i am making a site that generates youtube thumbnails and i am generating an image that displays 1

How to ... (FAQs)
... get e-mail notifications As several people asked how to get e-mail notifications when new posti

Connect to database that isn't localhost
I am currently doing a small script for a company that doesn't have mySql support on there hosting.

Data Function is Its Not working IN IE8
This is my first time to use formums. I hope i can get solution for this problem. view plaincopy to

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