This is a very basic script for creating a .csv file in PHP and is easy to set up and display information.
The Script
OK, here's the whole script. I'll explain how it works after:
|
<?php header ("Content-type: application/csv\nContent-Disposition: \"inline; filename=dates_of_year.csv\"");
echo "Day,Month,Year \n\n"; echo "1,6,2003\n"; echo "3,11,2003\n"; echo "19,2,2004\n"; ?> |
As you can see it is very basic. It will look something like this when you open the .csv file:
| Day |
Month |
Year |
| |
|
|
| 1 |
6 |
2003 |
| 3 |
11 |
2003 |
| 19 |
2 |
2004 |
How It Works
Very simple. For every box(See above) you want to display information in, you need to add a comma(,):
Day,Month,Year
And for every "break", you need to add a back slash and the letter n:
\n
Hope that helps you out in displaying data! You can aslo set it up to display MySQL results too!
Enjoy!