473,386 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

loading csv file into mysql

Hello,
I have discovered the beauties of the 'LOAD DATA INFILE' mysql
command. However, I was wondering if someone could help me manipulate
my command to accommodate for the 3 potential types of line endings --
'\n', '\r', and '\n\r' (or whatever is the default line ending on
Windows systems).

What I have so far is ...

$query = "LOAD DATA INFILE \"$src_file_path\" REPLACE INTO
TABLE HB_USPS_ZIP_CODES FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED
BY '\"' LINES TERMINATED BY '\n'";
$dbh = mysql_query($query);

Thanks for any help, - Dave
Jul 17 '05 #1
0 1521

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tom Chance | last post by:
Hullo, I've got a very, very odd problem here which I can't seem to solve. I'm creating a class instance in a CGI script, but that instance isn't inheriting all of the methods associated with...
1
by: Cindy Lee | last post by:
I need to insert rows into MySql database from oracle, which I imagine is a rather common task. The path I decided to take is write a java procedure, as recommended in the manual. However, java...
0
by: cmars | last post by:
Hi, I want to insert massive amounts of data in near real-time into a MySQL database. The data is in a structured binary format, and I have code that parses the data into logical data structures. ...
2
by: Beau E. Cox | last post by:
Hi - I have an application which is essentially 'read-only' - once the database is loaded it is only read from. So, I am trying to implement it with various indices and a table containg some...
0
by: Colin Prince | last post by:
Hi All, I am running mysql-3.23.52 on OS X (10.2.6) and I'd like to install the mod_auth_mysql module for a job I'm working on that used it under a different platform. I compiled the module...
4
by: Shaun Campbell | last post by:
I know you're going to say search the mail archives, but I have and I can't find an answer to my simple question of is there an SQL statement to load an image in a .jpg file into a database table?...
4
by: spwpreston | last post by:
Hello, I am new to MySQL. I am trying to load from a text file to a table, and am having problems with the fields in the text file being translated to the correct fields in the TABLE. Right...
6
by: theGreatGnu | last post by:
Hi all, I am new to PHP, Apache and Mysql. But I least I have managed to install everything on my home computer on my own and everything is up and running. I can fetch data from the database and...
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
2
by: Waqas.L.Khan | last post by:
Hi Guys, I'm doing some work with richtextboxes and want to be able to save and load the content from them to a mysql database (including all formatting). I figured the best way to do this would...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.