RE: [PHP] Re-Importing .CSV file into Database
Me thinks you need to have file privileges. See http://www.mysql.com/doc/P/r/Privileges_provided.html -Original Message- From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] the current problem at hand of getting the : error:Access denied for user: 'mjimm@localhost' (Using password: YES) is really jamming the thought process. i have no clue why this is happening on the Load Data Infile command only... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re-Importing .CSV file into Database
Good day, That's difficult to say, as I'm not familiar with running MySQL on Windows. You should print out $query, and then make sure the file exists and that the MySQL server has the permissions to read it. Remember that it's the server that's reading in the file, not whatever the client is (be it PHP or whatever). You should really take this conversation over to a MySQL list, since you need help with MySQL and not PHP. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 10:35 AM To: Darren Gamble Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Re-Importing .CSV file into Database Hi Darren, Actually your code worked, those errors did go way by putting in INTO TABLE .. but there's a very funny new problem. I get this error on the page : error:Access denied for user: 'mjimm@localhost' (Using password: YES) And believe me, i'm using the correct password/user! The same file, i just insert any other code than the $query, it works! But if i use the loading data infile code.. it gives me this access denied error! What is happening!! T. Edison jr. --- Darren Gamble <[EMAIL PROTECTED]> wrote: > Good day, > > The proper syntax is: > > INTO TABLE > > and not: > > INTO > > > Darren Gamble > Planner, Regional Services > Shaw Cablesystems GP > 630 - 3rd Avenue SW > Calgary, Alberta, Canada > T2P 4L4 > (403) 781-4948 > > > -Original Message- > From: Thomas Edison Jr. > [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 13, 2002 9:54 AM > To: Jason Murray > Cc: [EMAIL PROTECTED] > 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 : > > $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 : [EMAIL PROTECTED] > 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 : [EMAIL PROTECTED] 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
Re: [PHP] Re-Importing .CSV file into Database
> Enum is not a function; it's a mysql data type. It's very useful when field > values are from the finite set. > > Examples > > CREATE table fanlist_try (ID bigint(21) > NOT NULL auto_increment, name varchar(50), email > varchar(70), age int(10), sex enum('male','female'), country > varchar(50), PRIMARY KEY (ID)) > > and field sex now can have only 2 values - 'male' and 'female' > instead of VARCHAR - sorry! > the main reason to use it (instead of MySQL) is speed. The next one could be > data correctness ! > > Valentin Petruchek (aki Zliy Pes) > *** Cut the beginning *** > http://zliypes.com.ua > mailto:[EMAIL PROTECTED] > - Original Message - > From: "Thomas Edison Jr." <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Wednesday, February 13, 2002 7:36 PM > Subject: Re: [PHP] Re-Importing .CSV file into Database > > > > Val, > > > > quite frankly, i'm not quite sure i know what you're > > talking about. i don't think i know enum() function!! > > > > T. Edison jr. > > > > --- val petruchek <[EMAIL PROTECTED]> wrote: > > > > 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))"; > > > > > > sex varchar(20) sounds great. why do not use > > > enum('male','female')? or sex > > > has infinite set of possible values? > > > > > > > > > Valentin Petruchek (aki Zliy Pes) > > > *** Cut the beginning *** > > > http://zliypes.com.ua > > > mailto:[EMAIL PROTECTED] > > > > > > > > > > > > > > > -- > > > 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 : [EMAIL PROTECTED] > > 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re-Importing .CSV file into Database
Val, hey thanks.. that's a very interesting data type. wonder why i never knew it. thanks a bunch. i'll def. be using it more often now. the current problem at hand of getting the : error:Access denied for user: 'mjimm@localhost' (Using password: YES) is really jamming the thought process. i have no clue why this is happening on the Load Data Infile command only... T. Edison jr. --- val petruchek <[EMAIL PROTECTED]> wrote: > Enum is not a function; it's a mysql data type. It's > very useful when field > values are from the finite set. > > Examples > > CREATE table fanlist_try (ID bigint(21) > NOT NULL auto_increment, name varchar(50), email > varchar(70), age int(10), sex enum('male','female'), > country > varchar(50), PRIMARY KEY (ID)) > > and field sex now can have only 2 values - 'male' > and 'female' > > the main reason to use it (instead of MySQL) is > speed. The next one could be > data correctness > > Valentin Petruchek (aki Zliy Pes) > *** Cut the beginning *** > http://zliypes.com.ua > mailto:[EMAIL PROTECTED] > - Original Message - > From: "Thomas Edison Jr." <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Wednesday, February 13, 2002 7:36 PM > Subject: Re: [PHP] Re-Importing .CSV file into > Database > > > > Val, > > > > quite frankly, i'm not quite sure i know what > you're > > talking about. i don't think i know enum() > function!! > > > > T. Edison jr. > > > > --- val petruchek <[EMAIL PROTECTED]> wrote: > > > > 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))"; > > > > > > sex varchar(20) sounds great. why do not use > > > enum('male','female')? or sex > > > has infinite set of possible values? > > > > > > > > > Valentin Petruchek (aki Zliy Pes) > > > *** Cut the beginning *** > > > http://zliypes.com.ua > > > mailto:[EMAIL PROTECTED] > > > > > > > > > > > > > > > -- > > > 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 : [EMAIL PROTECTED] > > 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 : [EMAIL PROTECTED] 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
Re: [PHP] Re-Importing .CSV file into Database
Enum is not a function; it's a mysql data type. It's very useful when field values are from the finite set. Examples CREATE table fanlist_try (ID bigint(21) NOT NULL auto_increment, name varchar(50), email varchar(70), age int(10), sex enum('male','female'), country varchar(50), PRIMARY KEY (ID)) and field sex now can have only 2 values - 'male' and 'female' the main reason to use it (instead of MySQL) is speed. The next one could be data correctness Valentin Petruchek (aki Zliy Pes) *** Cut the beginning *** http://zliypes.com.ua mailto:[EMAIL PROTECTED] - Original Message - From: "Thomas Edison Jr." <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, February 13, 2002 7:36 PM Subject: Re: [PHP] Re-Importing .CSV file into Database > Val, > > quite frankly, i'm not quite sure i know what you're > talking about. i don't think i know enum() function!! > > T. Edison jr. > > --- val petruchek <[EMAIL PROTECTED]> wrote: > > > 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))"; > > > > sex varchar(20) sounds great. why do not use > > enum('male','female')? or sex > > has infinite set of possible values? > > > > > > Valentin Petruchek (aki Zliy Pes) > > *** Cut the beginning *** > > http://zliypes.com.ua > > mailto:[EMAIL PROTECTED] > > > > > > > > > > -- > > 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 : [EMAIL PROTECTED] > 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
Re: [PHP] Re-Importing .CSV file into Database
Val, quite frankly, i'm not quite sure i know what you're talking about. i don't think i know enum() function!! T. Edison jr. --- val petruchek <[EMAIL PROTECTED]> wrote: > > 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))"; > > sex varchar(20) sounds great. why do not use > enum('male','female')? or sex > has infinite set of possible values? > > > Valentin Petruchek (aki Zliy Pes) > *** Cut the beginning *** > http://zliypes.com.ua > mailto:[EMAIL PROTECTED] > > > > > -- > 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 : [EMAIL PROTECTED] 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
RE: [PHP] Re-Importing .CSV file into Database
Hi Darren, Actually your code worked, those errors did go way by putting in INTO TABLE .. but there's a very funny new problem. I get this error on the page : error:Access denied for user: 'mjimm@localhost' (Using password: YES) And believe me, i'm using the correct password/user! The same file, i just insert any other code than the $query, it works! But if i use the loading data infile code.. it gives me this access denied error! What is happening!! T. Edison jr. --- Darren Gamble <[EMAIL PROTECTED]> wrote: > Good day, > > The proper syntax is: > > INTO TABLE > > and not: > > INTO > > > Darren Gamble > Planner, Regional Services > Shaw Cablesystems GP > 630 - 3rd Avenue SW > Calgary, Alberta, Canada > T2P 4L4 > (403) 781-4948 > > > -Original Message- > From: Thomas Edison Jr. > [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 13, 2002 9:54 AM > To: Jason Murray > Cc: [EMAIL PROTECTED] > 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 : > > $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 : [EMAIL PROTECTED] > 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 : [EMAIL PROTECTED] 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
Re: [PHP] Re-Importing .CSV file into Database
> 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))"; sex varchar(20) sounds great. why do not use enum('male','female')? or sex has infinite set of possible values? Valentin Petruchek (aki Zliy Pes) *** Cut the beginning *** http://zliypes.com.ua mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re-Importing .CSV file into Database
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";"[EMAIL PROTECTED]";"16";"Male";"United States" 2;"PAUL MEADOWS";;"23";"Male";"United Kingdom" 3;"shefalee";"[EMAIL PROTECTED]";"15";"Female";"India" 4;"femke dees";"[EMAIL PROTECTED]";"14";"Female";"Netherlands" 5;"bram dees";"[EMAIL PROTECTED]";"48";"Male";"Netherlands" In fact, i'm attaching a portion of the .csv file i'm using... Thanks, T. Edison jr. --- Rick Emery <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]] > Sent: Wednesday, February 13, 2002 11:09 AM > To: Rick Emery > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] Re-Importing .CSV file into > Database > > > Oh yes, definately. With the appropriate columns > too. > > --- Rick Emery <[EMAIL PROTECTED]> wrote: > > Has fanlist_try table been created? > > > > -Original Message- > > From: Thomas Edison Jr. > > [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, February 13, 2002 10:54 AM > > To: Jason Murray > > Cc: [EMAIL PROTECTED] > > 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 : > > > > > $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 : [EMAIL PROTECTED] > > 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 : [EMAIL PROTECTED] > 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 : [EMAIL PROTECTED] 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
RE: [PHP] Re-Importing .CSV file into Database
Good day, The proper syntax is: INTO TABLE and not: INTO Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 9:54 AM To: Jason Murray Cc: [EMAIL PROTECTED] 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 : 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 : [EMAIL PROTECTED] 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
RE: [PHP] Re-Importing .CSV file into Database
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:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 11:09 AM To: Rick Emery Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Re-Importing .CSV file into Database Oh yes, definately. With the appropriate columns too. --- Rick Emery <[EMAIL PROTECTED]> wrote: > Has fanlist_try table been created? > > -Original Message- > From: Thomas Edison Jr. > [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 13, 2002 10:54 AM > To: Jason Murray > Cc: [EMAIL PROTECTED] > 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 : > > $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 : [EMAIL PROTECTED] > 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 : [EMAIL PROTECTED] 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
RE: [PHP] Re-Importing .CSV file into Database
Oh yes, definately. With the appropriate columns too. --- Rick Emery <[EMAIL PROTECTED]> wrote: > Has fanlist_try table been created? > > -Original Message- > From: Thomas Edison Jr. > [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 13, 2002 10:54 AM > To: Jason Murray > Cc: [EMAIL PROTECTED] > 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 : > > $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 : [EMAIL PROTECTED] > 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 : [EMAIL PROTECTED] 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
RE: [PHP] Re-Importing .CSV file into Database
Has fanlist_try table been created? -Original Message- From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 10:54 AM To: Jason Murray Cc: [EMAIL PROTECTED] 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 : 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 : [EMAIL PROTECTED] 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
Re: [PHP] Re-Importing .CSV file into Database
DL Neil, OK buddy, let me be more than frank with you.. i don't think i've been quite as confused and having the expression "what the hell are you tryin 2 say" on my lips in a while, as i had when i read your mail. Hmm.. i do hope u can help me though.. T. Edison jr. > Further to David's comment - the "mysql data > directory" (without pathname) is the database's own > directory (cf > the directory of databases - if that makes any > sense) - and any relative pathnames (obviously) > lead on from > there, so full pathnames are not necessarily > necessary. > > Also, when I did an import last night: > 1 it was not necessary to escape the double quote > field delimiters (it is within single quotes) > 2 because of the vagaries of Windows boxes, it was > necessary to ensure the record terminators were > treated > consistently - either build the export file with > only LF or instruct MySQL to use CRLF (as Jason put > it to "be > readable to the MySQL server daemon process thingy") > > Regards, > =dn > > > > -- > 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 : [EMAIL PROTECTED] 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
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 : 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 : [EMAIL PROTECTED] 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
Re: [PHP] Re-Importing .CSV file into Database
> > The error message might be useful, but in any case I think > > you need to enclose the source filename in quotes; also (you > > better check the docs here) if I remember correctly you need > > to give the full path to the source file unless it is in the > > mysql data directory. > > That's right, it needs to be quoted AND have the full path > (and be readable to the MySQL server daemon process thingy) Further to David's comment - the "mysql data directory" (without pathname) is the database's own directory (cf the directory of databases - if that makes any sense) - and any relative pathnames (obviously) lead on from there, so full pathnames are not necessarily necessary. Also, when I did an import last night: 1 it was not necessary to escape the double quote field delimiters (it is within single quotes) 2 because of the vagaries of Windows boxes, it was necessary to ensure the record terminators were treated consistently - either build the export file with only LF or instruct MySQL to use CRLF (as Jason put it to "be readable to the MySQL server daemon process thingy") Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re-Importing .CSV file into Database
> The error message might be useful, but in any case I think > you need to enclose the source filename in quotes; also (you > better check the docs here) if I remember correctly you need > to give the full path to the source file unless it is in the > mysql data directory. That's right, it needs to be quoted AND have the full path (and be readable to the MySQL server daemon process thingy) Jason (feeling very technical today) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re-Importing .CSV file into Database
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > Hi Rick, > > I tries your code but i'm constantly getting some > errors. I modified the line to try and correct the > error, and this is the code i'm using : > > $db = mysql_connect("localhost","mydb","pwd"); > mysql_select_db("mydb",$db); > > $query = "LOAD DATA INFILE list.csv INTO list_try > FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' > LINES TERMINATED BY '\n'"; > > mysql_query($query) or die("error:". mysql_error()); > echo "Thank you! Your information has been > entered.\n"; > ?> > > And i'm still getting errors on the mail $query line. > Can you say what is wrong? > > T. Edison Jr. The error message might be useful, but in any case I think you need to enclose the source filename in quotes; also (you better check the docs here) if I remember correctly you need to give the full path to the source file unless it is in the mysql data directory. -- David Robley Temporary Kiwi! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re-Importing .CSV file into Database
Hi Rick, I tries your code but i'm constantly getting some errors. I modified the line to try and correct the error, and this is the code i'm using : And i'm still getting errors on the mail $query line. Can you say what is wrong? T. Edison Jr. --- Rick Emery <[EMAIL PROTECTED]> wrote: > connect to your mysql server > select the mysql database > > $query = "LOAD DATA INFILE "datafile.csv" INTO > mytable ". > "FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY > '\"' ". > "LINES TERMINATED BY '\n' "; > > mysql_query($query) or die("error:". mysql_error()); > > -Original Message----- > From: Thomas Edison Jr. > [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 12, 2002 1:11 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Re-Importing .CSV file into > Database > > > I have space on a server on the internet. I have > mySQL > & PHP4 support. And i can easily upload the .CSV > files > on the server itself. > Could you kindly help me out with the php code that > would make this possible.. > > Thanks, > T. Edison jr. > > --- Rick Emery <[EMAIL PROTECTED]> wrote: > > The file is located on the server and you have > > access to it, yes. If the > > file is on the client, then no > > > > -Original Message- > > From: Thomas Edison Jr. > > [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, February 12, 2002 12:21 PM > > To: Rick Emery > > Subject: RE: [PHP] Re-Importing .CSV file into > > Database > > > > > > HI, > > > > Thanks.. i will try this. But tell me, can this > same > > be executed through a php page rather than the > mySQL > > command line? > > > > T. Edison Jr. > > > > --- Rick Emery <[EMAIL PROTECTED]> wrote: > > > look at MYSQL's LOAD DATA INFILE command: > > > > > > LOAD DATA INFILE "datafile.csv" INTO mytable > > FIELDS > > > TERMINATED BY ',' > > > OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY > > '\n' > > > > > > -Original Message- > > > From: Thomas Edison Jr. > > > [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, February 12, 2002 12:02 PM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] Re-Importing .CSV file into > > Database > > > > > > > > > Glory! > > > > > > I have a bunch of .CSV (Microsoft Excel Comma > > > Seperated Values) Files with me, whose data i > want > > > to > > > put back into my mySQL database tables. How can > i > > do > > > that through php? or otherwise... > > > > > > thanks, > > > T. Edison jr. > > > > > > > > > = > > > Rahul S. Johari (Director) > > > ** > > > Abraxas Technologies Inc. > > > Homepage : http://www.abraxastech.com > > > Email : [EMAIL PROTECTED] > > > 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 : [EMAIL PROTECTED] > > Tel : 91-4546512/4522124 > > *** > > > > __ > > Do You Yahoo!? > > Send FREE Valentine eCards with Yahoo! Greetings! > > http://greetings.yahoo.com > > > = > Rahul S. Johari (Director) > ** > Abraxas Technologies Inc. > Homepage : http://www.abraxastech.com > Email : [EMAIL PROTECTED] > 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 : [EMAIL PROTECTED] 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
RE: [PHP] Re-Importing .CSV file into Database
connect to your mysql server select the mysql database $query = "LOAD DATA INFILE "datafile.csv" INTO mytable ". "FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ". "LINES TERMINATED BY '\n' "; mysql_query($query) or die("error:". mysql_error()); -Original Message- From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 1:11 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Re-Importing .CSV file into Database I have space on a server on the internet. I have mySQL & PHP4 support. And i can easily upload the .CSV files on the server itself. Could you kindly help me out with the php code that would make this possible.. Thanks, T. Edison jr. --- Rick Emery <[EMAIL PROTECTED]> wrote: > The file is located on the server and you have > access to it, yes. If the > file is on the client, then no > > -Original Message- > From: Thomas Edison Jr. > [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 12, 2002 12:21 PM > To: Rick Emery > Subject: RE: [PHP] Re-Importing .CSV file into > Database > > > HI, > > Thanks.. i will try this. But tell me, can this same > be executed through a php page rather than the mySQL > command line? > > T. Edison Jr. > > --- Rick Emery <[EMAIL PROTECTED]> wrote: > > look at MYSQL's LOAD DATA INFILE command: > > > > LOAD DATA INFILE "datafile.csv" INTO mytable > FIELDS > > TERMINATED BY ',' > > OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY > '\n' > > > > -Original Message- > > From: Thomas Edison Jr. > > [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, February 12, 2002 12:02 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Re-Importing .CSV file into > Database > > > > > > Glory! > > > > I have a bunch of .CSV (Microsoft Excel Comma > > Seperated Values) Files with me, whose data i want > > to > > put back into my mySQL database tables. How can i > do > > that through php? or otherwise... > > > > thanks, > > T. Edison jr. > > > > > > = > > Rahul S. Johari (Director) > > ** > > Abraxas Technologies Inc. > > Homepage : http://www.abraxastech.com > > Email : [EMAIL PROTECTED] > > 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 : [EMAIL PROTECTED] > Tel : 91-4546512/4522124 > *** > > __ > Do You Yahoo!? > Send FREE Valentine eCards with Yahoo! Greetings! > http://greetings.yahoo.com = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] 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
RE: [PHP] Re-Importing .CSV file into Database
I have space on a server on the internet. I have mySQL & PHP4 support. And i can easily upload the .CSV files on the server itself. Could you kindly help me out with the php code that would make this possible.. Thanks, T. Edison jr. --- Rick Emery <[EMAIL PROTECTED]> wrote: > The file is located on the server and you have > access to it, yes. If the > file is on the client, then no > > -Original Message- > From: Thomas Edison Jr. > [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 12, 2002 12:21 PM > To: Rick Emery > Subject: RE: [PHP] Re-Importing .CSV file into > Database > > > HI, > > Thanks.. i will try this. But tell me, can this same > be executed through a php page rather than the mySQL > command line? > > T. Edison Jr. > > --- Rick Emery <[EMAIL PROTECTED]> wrote: > > look at MYSQL's LOAD DATA INFILE command: > > > > LOAD DATA INFILE "datafile.csv" INTO mytable > FIELDS > > TERMINATED BY ',' > > OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY > '\n' > > > > -Original Message- > > From: Thomas Edison Jr. > > [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, February 12, 2002 12:02 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Re-Importing .CSV file into > Database > > > > > > Glory! > > > > I have a bunch of .CSV (Microsoft Excel Comma > > Seperated Values) Files with me, whose data i want > > to > > put back into my mySQL database tables. How can i > do > > that through php? or otherwise... > > > > thanks, > > T. Edison jr. > > > > > > = > > Rahul S. Johari (Director) > > ** > > Abraxas Technologies Inc. > > Homepage : http://www.abraxastech.com > > Email : [EMAIL PROTECTED] > > 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 : [EMAIL PROTECTED] > Tel : 91-4546512/4522124 > *** > > __ > Do You Yahoo!? > Send FREE Valentine eCards with Yahoo! Greetings! > http://greetings.yahoo.com = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] 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
Re: [PHP] Re-Importing .CSV file into Database
> Glory! > > I have a bunch of .CSV (Microsoft Excel Comma > Seperated Values) Files with me, whose data i want to > put back into my mySQL database tables. How can i do > that through php? or otherwise... Take a look at MySQL-Front - its menu system talks about CSV (I've not had an excuse to use it). MySQL offers LOAD DATA INFILE, etc. Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re-Importing .CSV file into Database
look at MYSQL's LOAD DATA INFILE command: LOAD DATA INFILE "datafile.csv" INTO mytable FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' -Original Message- From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 12:02 PM To: [EMAIL PROTECTED] Subject: [PHP] Re-Importing .CSV file into Database Glory! I have a bunch of .CSV (Microsoft Excel Comma Seperated Values) Files with me, whose data i want to put back into my mySQL database tables. How can i do that through php? or otherwise... thanks, T. Edison jr. = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] 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