Jump to content

k7l2010

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by k7l2010

  1. مرحبا من فضلك مساعدة ماذا يفتقر هذا الرمز للعمل؟ مطلوب عدم تكرار الحقل في ملف نصي يرجى تعديل الكود

    <?php
    
    if(isset($_POST['send'])){
    $b1 = $_POST['b1'];
    $b2 = $_POST['b2'];
    
    
    $file = fopen("xm.txt", "a+");
    
    				for($i = 0; $i < count($file); $i++){
    					$read = explode("||" ,$file[$i]);
     
    
        if($read[0] == $b1  ){
    
            echo 'Duplicate';
     
    }
    else
    {
    
     
    
       fwrite($random_file,$b1.'||'.$b2."\r\n");
      fclose($random_file);
    
     
       }
    
    }
    
    }
    
    ?>

     

  2. Please help and amend the code Save without repetition required $read[0] I hope that my example is clear to you I apologize for bothering you. I am not good in English

    <?php
    
      $fileLocation = getenv("DOCUMENT_ROOT") . "/rt.txt";
      $file = fopen($fileLocation,"a");
    $n1 = $_POST['n1'];
    $n2 = $_POST['n2'];
     	for($i = 0; $i <  count($file); $i++){
    
     $read = explode("|", $file[$i]);
    			if($n1 == $read[0]){
    echo 'Repetition';
        }
        else
       {
    
      fwrite($file,$n1.'|'.$n2."\r\n");
    
    }

     

×
×
  • 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.