Re: Parse Question Using list()

From: Date: Fri, 02 Oct 2009 04:50:00 +0000
Subject: Re: Parse Question Using list()
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-298459@lists.php.net to get a copy of this message
cool@hosting4days.com wrote:
On Oct 1, 2009, at 5:02 PM, Ben Dunlap wrote:
You could tackle this in a couple of different ways. Either split your string into an array first: $line = fgets($handle); $columns = explode(",", trim($line));
Thanks Ben - the explode() command worked great!
Use the tool that PHP provides for such problems. http://php.net/fgetcsv
--------- Now a bit of another problem I'm exporting from another database (mac) to a csv file then a quick import to excel 2004 (mac) for some cleaning... before the excel import, some date fields look like "2009-9-29 11:21:37" = good for sql import but excel does an auto reformat to 9/29/2009 11:21:37 AM = not good for sql import Q: any way to turn this auto reformat off in excel and keep it the way I had it? (I saw nothing in pref's)
try using strtotime() on that field and see if it works. http://php.net/strtotime I'm pretty sure that function will handle it.
Thanks, cool@hosting4days.com
-- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare

« previous php.general (#298459) next »