You are here: Re: CSV into array « PHP Programming Language « IT news, forums, messages
Re: CSV into array

Posted by Erwin Moller on 10/12/05 12:56

Tom wrote:

> PHP Gurus...
>
> Can anyone give me a helping hand with this.
>
> I'm more ASP, but trying to move to PHP and sturggling a bit.
>
> I have a few products stored in a csv file created in Excel. Column 1
> is the part #, column 2 is title, column 3 is color, column 4 is width
> and 5 is price.
>
> I need to read these into arrays, with a seperate array for each
> column.
>
> Can anyone suggest anything?
>
> If someone could point me in the right direction it would be much
> appreciated!
>
> Tom

Hi Tom,

Try something like this:
1) find out what the end-of-line is. Probably \n
2) read the csv into an array using file().
Now each arrayelement is a row from the csv.
check www.php.net for details.

3) Explode each line, using the seperator for columns. (can be tab \t or ,
or whatever you decided.)

Good luck.

Regards,
Erwin Moller

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация