title: Uploading a csv using php into MySQL and update as well
body: <p>Ok so i have a database table called requests with this structure</p>
  
  <pre><code>mysql&gt; desc requests;
  +------------+--------------+------+-----+---------+----------------+
  | Field      | Type         | Null | Key | Default | Extra          |
  +------------+--------------+------+-----+---------+----------------+
  | id         | int(11)      | NO   | PRI | NULL    | auto_increment |
  | artist     | varchar(255) | YES  |     | NULL    |                |
  | song       | varchar(255) | YES  |     | NULL    |                |
  | showdate   | date         | YES  |     | NULL    |                |
  | amount     | float        | YES  |     | NULL    |                |
  +------------+--------------+------+-----+---------+----------------+
  </code></pre>
  
  <p>Here is some example data</p>
  
  <pre><code>+----+-----------+-------------------------+------------+--------+
  | id | artist    | song                    | showdate   | amount |
  +----+-----------+-------------------------+------------+--------+
  |  6 | Metallica | Hello Cruel World       | 2010-09-15 | 10.00  |
  |  7 | someone   | Some some               | 2010-09-18 | 15.00  |
  |  8 | another   | Some other song         | 2010-11-10 | 45.09  |
  +----+-----------+-------------------------+------------+--------+
  </code></pre>
  
  <p>I need a way to be able to give user a way to upload a csv with the same structure and it updates or inserts based on whats in the csv. I have found many scripts online but most have a hard coded csv which is not what i need. I need the user to be able to upload the csv...Is that easy with php....</p>
  
  <p>Here is an example csv</p>
  
  <pre><code>id  artist          song           showdate    amount
  11  NewBee          great stuff    2010-09-15  12.99
  10  anotherNewbee   even better    2010-09-16  34.00
  6    NewArtist       New song       2010-09-25  78.99
  </code></pre>
  
  <p>As you can see i have id 6 which is already in the database and needs to be updated..The other two will get inserted</p>
  
  <p>I am not asking for someone to write the whole script but if i can get some direction on the upload and then where to go from there....thanks</p>