Mon Oct 27, 2008 6:33 pm
<?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();
?>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.