[thelist] Odd Behavior last night with MySQL Server
Hassan Schroeder
hassan at webtuitive.com
Fri Aug 6 15:37:04 CDT 2004
Rob Smith wrote:
> Hassan. Let me put it in this light, and maybe you'll see what I see.
> remember, I'm parsing from a text file and lines.
>
> My newer version looks like this
> 47|"Home"|"Books"|"Audiobooks"|"Movies, Music & Entertainment"|""
> $line = explode("|",stripslashes($contents[$i]));
Ah, OK -- I don't do PHP so I didn't recognize "explode" :-)
But just for future reference -- won't you still have a problem if
a given line "explodes" to fewer than the required number of columns?
You might want to add an array-length check, and pad to the required
number of fields if necessary.
Or use LOAD DATA INFILE on your raw CSV file, of course.
--
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
More information about the thelist
mailing list