RE: Uploaded CSV -> database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Mark Rees [mailto:mrees@xxxxxxxxxxxxxxxxx]
> Sent: Monday, October 17, 2005 11:11 AM
> To: php-general@xxxxxxxxxxxxx
> Subject: Re:  Uploaded CSV -> database
> 
> 
> > > -----Original Message-----
> > > From: Jim Moseby [mailto:JMoseby@xxxxxxxxxxxxxxxxx]
> > > Sent: Monday, October 17, 2005 10:41 AM
> > > To: 'Brian Dunning'; php-general@xxxxxxxxxxxxx
> > > Subject: RE:  Uploaded CSV -> database
> > >
> > >
> > > > -----Original Message-----
> > > > From: Brian Dunning [mailto:brian@xxxxxxxxxxxxxxxx]
> > > > Sent: Monday, October 17, 2005 10:37 AM
> > > > To: php-general@xxxxxxxxxxxxx
> > > > Subject:  Uploaded CSV -> database
> > > >
> > > >
> > > > Does anyone have an example of code to process a CSV file
> > > submitted
> > > > via a file upload and parse it out in order to write its
> > > > records to a
> > > > db?
> > > >
> > >
> > >
> > > With MYSQL (assuming permissions and such are in order) You
> > > would simply:
> > >
> > > $sql="load data local infile '/path/to/csv' into table
> > > tablename fields
> > > terminated by ','";
> > >
> >
> > I should amend this to say that the columns in your CSV 
> file, and in the
> > table must match for this to work.
> >
> > If you wanted to parse through it line by line and do it 
> all manually,
> check
> > out the fread() and explode() functions in the PHP manual.
> 
> and don't forget fgetcsv()

Thanks! Good one.  I didn't forget it, I just didn't know about it.  :-)

JM

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux