i have a text file with some of this elements:
 
name:adress:telephone:email:password

i want to delete this line using for identifier the 'name' only.

// $sterge_user="name"; this is the value sent by form witch will be the identifier
// $path="some_of_my_files"; the file used here allready set with 777 chmod

function delete_user($sterge_user, $path){
$i = 0;
    $fisierul = file($path);
    $fp = fopen($path, "w");
    while (!sizeof($fisierul))
     {
        $data = fgetcsv ($fisierul, 4096, ":");
             if ($data[0]==$sterge_user)
    {
   for ($i=0; $i<=sizeof($data);){$data[i]="";++$i;}
    }
     fwrite($fp, $data);
  }
    fclose($fp);
}

I am waiting for an answer, please

Nick

Reply via email to