"Richard Grove" <info[at]redeyemedia[dot]co[dot]uk> writes:
[color=blue]
> "Michael Fuhr" <mfuhr@fuhr.org> wrote in message
> news:3fb8f879$1_1@omega.dimensional.com...[color=green]
> > "Richard Grove" <info[at]redeyemedia[dot]co[dot]uk> writes:
> >[color=darkred]
> > > I import a CSV file which is then read using fgetcsv();
> > > My problem is that if the fields in the CSV file have commas in them,[/color][/color]
> the[color=green][color=darkred]
> > > whole thing bugs out.[/color]
> >
> > What exactly happens when "the whole thing bugs out"? Are the
> > commas in the fields inside quotation marks? Are there quotation
> > marks in the file that could be confusing fgetcsv()?
> >
> > Could you post a line from the CSV file and the code you're using
> > to read it? That way we could see exactly what's happening.[/color]
>
> My CSV file doesn't have quotes.[/color]
If a comma is the field separater, and if a field's value contains
commas, then that field needs to be quoted. Without some way to
distinguish which commas are part of a field and which commas
separate different fields, you'll get unexpected results.
[color=blue]
> When it bugs out, what I meant to say was that when it populates the
> databse, it skips columns and puts values in the wrong place.
> Not really bugging out I suppose.[/color]
Make sure you're reading the data correctly before worrying about
how it's inserted into a database.
As I asked before, please post a troublesome line from the CSV file
and the code you're using to read it. If we can see what you're
doing then we might be able to offer advice on how to fix the
problem.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/