-
Domo Arigato!
CSV Issue with PHP
We have written a PHP script that imports your contact list from Microsoft Outlook. It works fine, but Outlook itself presents a problem when exporting the CSV. The script uses explode to form an array, and then identifies each item in the array as one of our fields:
Code:
$values = explode("," , $values);
Pretty simple...but...
If you have a contact named "Smith, John", it exports that comma there. As a result, using explode breaks up Smith and John and puts them into the array as two separate items rather than one.
Any ideas on how can we get this to be "Smith, John" instead of "Smith" and "John"? Each value in the Outlook CSV is surrounded by a quotation mark on each side and is separated by commas ("Smith, John","abcd@abcd.net",etc.)
I really enjoy forgetting. When I first come to a place, I notice all the little details. I notice the way the sky looks. The color of white paper. The way people walk. Doorknobs. Everything. Then I get used to the place and I don't notice those things anymore. So only by forgetting can I see the place again as it really is.
-
Hi,
there may be a csv module in php to do it right. If not, consider ereg or preg functions to get the "data" items.
It may still be a problem if quote marks are allowed in the database (and appear doubled in the csv file)
Musicman
-
Hi there,
you could always use tab delimeted files rather than csv files, when exporting from outlook...
but then again, if someone puts a tab character in an address field or something, then you're in the same boat
you'd have thought that microsoft would let export as xml by now, or would that be too useful
hope this helps,
Andy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|