Page 1 of 1

Parsing CSV in to a table?

Posted: Wed Nov 06, 2002 11:42 am
by atw
Does anyone have a simple PHP script to read a CSV file and parse it into a table.

Thanks for your time...

atw

Posted: Thu Nov 07, 2002 5:20 am
by Oleg Butuzov
$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.

}

Posted: Thu Nov 07, 2002 6:31 am
by atw
Excellent, thank you...

Just one question,
$data=explode(";" , $csvfile[$i]);
does the ";" denote (signify) the delimiter character?


Thanks for your time :D

Posted: Thu Nov 07, 2002 9:35 am
by PHP Guru
yes

Posted: Thu Nov 07, 2002 10:03 am
by Oleg Butuzov
2PHP Guru
Jay, why you register new account ?

Posted: Thu Nov 07, 2002 2:52 pm
by PHP Guru
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!!

Posted: Thu Nov 07, 2002 3:46 pm
by atw
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???

Posted: Thu Nov 07, 2002 4:04 pm
by PHP Guru
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)

Posted: Fri Nov 08, 2002 4:30 am
by Oleg Butuzov
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...

Posted: Fri Nov 08, 2002 4:58 am
by admin
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