Hi,
I have a .txt file with about 2,000 mobile numbers on it. There are at least 50 duplicate numbers in there. I also have made a page to add in more numbers, and below that I’ve tried to put a button that will clear the txt file of all duplicates, but it does not work. Please see my code below:
<?php $numbers = $_REQUEST['numbers']; $file = "../smsm.txt"; $fh = fopen($file,'a') or die ("Can't Save Number."); fwrite($fh, $numbers); fclose($fh); ///////////////////////////////////////////// $clean = $_REQUEST['clean']; $conf = "1"; if($clean == $conf) { $filename = "../smsm.txt"; $list = file($filename); // Remove duplicates $list = array_unique($list); // Write back to file file_put_contents($filename, implode('', $list)); } ?> RISE Productions | SMS<>
Clean database of duplicate numbers?