Does anyone have a simple PHP script to read a CSV file and parse it into a table.
Thanks for your time...
atw
Parsing CSV in to a table?
Moderators: egami, macek, gesf
-
- Last Samuray
- Posts: 824
- Joined: Sun Jun 02, 2002 3:09 am
$csvfile=file("file.txt");
for ($i=0; $i < count($csvfile); $i++ )
{
//this action will explode values in the csv file
$data=explode(";" , $csvfile[$i]);
//you can do enything you want with values thay are look like that $data[0] $data[3] etc.
}
for ($i=0; $i < count($csvfile); $i++ )
{
//this action will explode values in the csv file
$data=explode(";" , $csvfile[$i]);
//you can do enything you want with values thay are look like that $data[0] $data[3] etc.
}
-
- Last Samuray
- Posts: 824
- Joined: Sun Jun 02, 2002 3:09 am
2PHP Guru
Jay, why you register new account ?
Jay, why you register new account ?
You got a problem with that? No-one said not to come back! And at the end of the day, I know more PHP than all you guys put together. You even had to copy my php-forums.com logo!!
Calm down, chill-out.
Thank you both for the help, it worked beautifully.
Checkout: http://www.atwright.com/phpxml/csvtest2.php
(The table coding needs a little tweeking but it'll work as a temporary measure until I get the MySQL DB up and running :wink:
Thanks again...
PS. Why is the forum moving???
Thank you both for the help, it worked beautifully.
Checkout: http://www.atwright.com/phpxml/csvtest2.php
(The table coding needs a little tweeking but it'll work as a temporary measure until I get the MySQL DB up and running :wink:
Thanks again...
PS. Why is the forum moving???
It's not, DoppyNL and myself have moved to provide a better service with more features and enhancements (I can't say more 'cos my ideas will be stolen, like my logo)
-
- Last Samuray
- Posts: 824
- Joined: Sun Jun 02, 2002 3:09 am
I have no problem with this!
Chill out man! I just ask you...
This is your own buisness where is in NET you are live...
Chill out man! I just ask you...
This is your own buisness where is in NET you are live...
PHP Guru wrote:It's not, DoppyNL and myself have moved to provide a better service with more features and enhancements (I can't say more 'cos my ideas will be stolen, like my logo)
1) there are tons of php site which use <? ?> in their logo , this is an example , http://www.phpcomplete.com .
2) you have copied the idea and domain name and you attempted to move all registered users from here to there taking advantage of your moderator powers and hoping that I was sleeping . and you have still the courage to speak ....
Your forum is better and you are a php guru ; but please don't disturb us again , here we want speak of php . If you want promote your site you can use search engines .
If you want stay here , you can stay ,but you cannot spam in the way Jay and Doppy was doing . Here you can speak of php nothing else.
Thank you