<p>I am new to MySQL and PHP(as you can probably tell) and I was wondering if anybody knew an easy way to import a CSV file into a MySQL table.</p>

<blockquote>
  <p>"There are any number of ways to input
  csv into mysql depending in what kind
  of access you have, if you can use the
  mysql client directly there is a
  command to load delimited data,
  something like that could basically be
  entered directly in cron and keep
  itself up to date. Otherwise there are
  various php scripts to do that sort of
  thing."</p>
</blockquote>

<p>That is something a friend told me to do, is that the easiest/best way to do it? If it is would someone mind explaining it to me?</p>

<p>Thank you </p>

Use the "load data infile"  command. By deafulat it will treat incoming files as csv, although you can define a custom file type to import. Documentation for load data infile is here:
http://dev.mysql.com/doc/refman/5.0/en/load-data.html
FTA, in its simplest form the command looks just like this:
```
```
LOAD DATA INFILE 'data.txt' INTO TABLE db2.my_table;
```
```
That assumes the columns in the data file and in your text file line up. 
The rest of the documentation explains how to get non-lined up fields imported, and also how to deal with windows vs unix style line terminations.