RE: [PHP] Re-Importing .CSV file into Database
| From: | Thomas Edison Jr. | Date: | Wed, 13 Feb 2002 17:23:10 +0000 |
| Subject: | RE: [PHP] Re-Importing .CSV file into Database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84613@lists.php.net to get a copy of this message | ||
Hi Rick,
Thanks for the support!
This is the mySQL Table Structure :
$sql = "CREATE table fanlist_try (ID bigint(21) NOT
NULL auto_increment, name varchar(50), email
varchar(70), age int(10), sex varchar(20), country
varchar(50), PRIMARY KEY (ID))";
And these are few lines from the fanlist.csv file :
1;"Akshay
Dodeja";"contact@activemasti.com";"16";"Male";"United
States"
2;"PAUL MEADOWS";;"23";"Male";"United Kingdom"
3;"shefalee";"shefalee1@rediffmail.com";"15";"Female";"India"
4;"femke
dees";"invincible_femke@hotmail.com";"14";"Female";"Netherlands"
5;"bram
dees";"B.Dees@skynet.be";"48";"Male";"Netherlands"
In fact, i'm attaching a portion of the .csv file i'm
using...
Thanks,
T. Edison jr.
--- Rick Emery <remery@excel.com> wrote:
> Thomas,
>
> Can you provide your table structure and about a
> dozen lines from your file?
>
> I'd like to experiment with it on my machine.
>
> We WILL get this resolved...
>
> rick
>
> -----Original Message-----
> From: Thomas Edison Jr.
> [mailto:thomasedisonjr@yahoo.com]
> Sent: Wednesday, February 13, 2002 11:09 AM
> To: Rick Emery
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] Re-Importing .CSV file into
> Database
>
>
> Oh yes, definately. With the appropriate columns
> too.
>
> --- Rick Emery <remery@excel.com> wrote:
> > Has fanlist_try table been created?
> >
> > -----Original Message-----
> > From: Thomas Edison Jr.
> > [mailto:thomasedisonjr@yahoo.com]
> > Sent: Wednesday, February 13, 2002 10:54 AM
> > To: Jason Murray
> > Cc: php-general@lists.php.net
> > Subject: RE: [PHP] Re-Importing .CSV file into
> > Database
> >
> >
> > Hi,
> >
> > Ok, considering the FULL PATH and the QUOTES
> thingy,
> > this is the code i'm applying :
> >
> > <?php
> > $db = mysql_connect("localhost","mydb","pwd");
> > mysql_select_db("mydb",$db);
> >
> > $query = "LOAD DATA INFILE 'D:\Apache
> >
>
Group\Apache\htdocs\mjimm\php3\tabledata\fanlist.csv'
> > INTO fanlist_try FIELDS TERMINATED BY ','
> OPTIONALLY
> > ENCLOSED BY '\"' LINES TERMINATED BY '\n' ";
> >
> > mysql_query($query) or die("error:".
> mysql_error());
> > ?>
> >
> > And this is the error i'm getting :
> >
> > error:You have an error in your SQL syntax near
> > 'fanlist_try FIELDS TERMINATED BY ',' OPTIONALLY
> > ENCLOSED BY '"' LINES TERMINATED' at line 1
> >
> > So... what's the problem??
> >
> > Thanks guys, though.
> > T. Edison jr.
> >
> >
> >
> > =====
> > Rahul S. Johari (Director)
> > ******************************************
> > Abraxas Technologies Inc.
> > Homepage : http://www.abraxastech.com
> > Email : abraxastech@yahoo.com
> > Tel : 91-4546512/4522124
> > *******************************************
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Send FREE Valentine eCards with Yahoo! Greetings!
> > http://greetings.yahoo.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
>
>
> =====
> Rahul S. Johari (Director)
> ******************************************
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : abraxastech@yahoo.com
> Tel : 91-4546512/4522124
> *******************************************
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
=====
Rahul S. Johari (Director)
******************************************
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : abraxastech@yahoo.com
Tel : 91-4546512/4522124
*******************************************
__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com