Jump to content

fwrite


Schlo_50

Recommended Posts

I have a .DAT file which I want to remove lines from. I have some code but it needs tweaking, as it doesn't delete any lines from my file at all.

 

if ($_GET['action'] == "delete"){

foreach($file as $key => $val){

$data[$key] = explode("|", $val);

if($_GET['pid'] == $data[$key][0]) {

  unset($file[$key]);
  $fp = fopen("data/customer.DAT", "w");
  fwrite($fp, implode('', $file));
  fclose($fp);
print "Deleted";
}

}

}

 

Thanks in advance guys!

Link to comment
https://forums.phpfreaks.com/topic/98780-fwrite/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.