<?php $conn = mysql_connect("localhost","someuser","secret"); $db = mysql_select_db("cars"); $fh = fopen("yourCSVFile.csv", "r"); while ($line = fgetcsv($fh, 1000, ",")) { $year = $line[0]; $make = $line[1]; $color = $line[2]; $query = "INSERT INTO carcollection SET year='$year', make='$make',color='$color'"; $result = mysql_query($query); } fclose($fh); mysql_close();?>