You are here: Re: [PHP] Automated data upload for customers « PHP « IT news, forums, messages
Re: [PHP] Automated data upload for customers

Posted by "Richard Lynch" on 09/25/88 11:24

On Fri, August 19, 2005 3:47 pm, Jasper Bryant-Greene wrote:
> Brian Dunning wrote:
>> I have a system where I'm trying to facilitate a process for
>> customers
>> to upload data to me (basically a list of people), and have it go
>> into
>> a database. I can give them certain parameters, like it has to be a
>> CSV
>> file, delimited in such a way, etc. but can't ask much more of them
>> than that, since people are largely stupid. :)
>
> For CSV, it's as simple as explode() the data by "\n" (perhaps strip
> out
> any "\r" before you start) and then explode() by ",". Depending on the
> software they're using, you might also need to remove any delimiters
> on
> each field of data, such as quote marks (").

No, it's not that simple, as embedded commas can be inside of quotes,
and then quote quote is used for quotes inside of quotes.

Which is why PHP has a function for reading CSV files.
http://php.net/fgetcsv I believe.

> If other file formats are possible as well as CSV, you might like to
> look at the PEAR "File Formats" packages[1].

Now TAB delimited is generally easier than CSV as it IS as simple as
reading a line and explode() on "\t"

--
Like Music?
http://l-i-e.com/artists.htm

 

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

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