RE: [PHP] Re-Importing .CSV file into Database

From: Date: Tue, 12 Feb 2002 19:41:37 +0000
Subject: RE: [PHP] Re-Importing .CSV file into Database
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-84431@lists.php.net to get a copy of this message
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 : <?php $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. --- Rick Emery <remery@excel.com> 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:thomasedisonjr@yahoo.com] > Sent: Tuesday, February 12, 2002 1:11 PM > To: php-general@lists.php.net > 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 <remery@excel.com> 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:thomasedisonjr@yahoo.com] > > 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 <remery@excel.com> 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:thomasedisonjr@yahoo.com] > > > Sent: Tuesday, February 12, 2002 12:02 PM > > > To: php-general@lists.php.net > > > 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 : 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 > > > ===== > 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

« previous php.general (#84431) next »