<?php

$id = $_GET['id'];  
$fptemp = fopen('history-temp.csv', "a+");
if (($handle = fopen('history.csv', "r")) !== FALSE) {
    while (($data = fgetcsv($handle)) !== FALSE) {
        if ($id != $data[0] ){
            $list = $data;
            fputcsv($fptemp, $list);
        }
    }
}
fclose($handle);
fclose($fptemp);
unlink('history.csv');
rename('history-temp.csv','history.csv');

?>