brin has asked for the wisdom of the Perl Monks concerning the following question:
It only worked when I went into PHPMyAdmin on the server, from a text file on my hard drive to the table, but I wanted to do it from the script as hereunder which was the script I tried to load data on a text file on the server to a table in the database. I did not receive any error notices when I brought the file up in the address and pressed enter and/or refresh. I knew it didn't work because when I refreshed the table there was no new data therein:-
#!/user/bin/perl use CGI::Carp qw(fatalsToBrowser); use DBI; print "Content-type:text/html\n\n"; #open connection to access database $dbh = DBI->connect("DBI:mysql:bgoddard_musicexperiences:localhost","",""); #prepare and execute SQL statement $sqlstatement="LOAD DATA LOCAL INFILE 'reas_orders.txt' INTO TABLE 're +as_orders' FIELDS TERMINATED BY '/' ESCAPED BY '\\' LINES TERMINATED BY '\r\n'"; $sth = $dbh->prepare($sqlstatement); $sth->execute or die "Could not execute SQL statement ... maybe invalid?"; $dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LOAD DATA LOCAL INFILE
by davido (Cardinal) on Jul 16, 2004 at 15:54 UTC | |
by brin (Initiate) on Jul 16, 2004 at 16:23 UTC | |
|
Re: LOAD DATA LOCAL INFILE
by BrowserUk (Patriarch) on Jul 16, 2004 at 16:51 UTC | |
|
Re: LOAD DATA LOCAL INFILE
by naChoZ (Curate) on Jul 16, 2004 at 15:56 UTC | |
by brin (Initiate) on Jul 16, 2004 at 17:00 UTC |