I would like to insert a CSV to MySQL. How can I only update my table if the column sha1 is existing in MySQL table? If the column sha1 was exist, insert it.
I have this code to insert csv:
while(($csvdata = fgetcsv($handle,10000,","))!== FALSE){
if($i>0) {
$sha1 = $csvdata[0];
$vsdt = $csvdata[1];
$trendx = $csvdata[2];
$notes = $csvdata[3];
$sql = "INSERT INTO jeremy_table_trend (date_sourced,sha1,vsdt,trendx,notes) VALUES ('$date','$sha1','$vsdt','$trendx','$notes')";
$query = mysqli_query($con , $sql);
$c = $c+1;
error_reporting(E_ALL ^ E_NOTICE);
}
$i++;
error_reporting(E_ALL ^ E_NOTICE);
}