Jump to content

Search the Community

Showing results for tags 'check for duplicates'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. hi, im a bit new to php programming, and im trying to make this: - user enters data on webpage and i store them to a txt file (this worked easily ...) - then i wanted to compare the string that users add to already saved data in txt files. so reading line by line .... it is suppose to be working like this: if there is a duplicate entery, close file and echo "duplicate entery". i use strcmp to compare two string and its kind a frustrating, cause i get in infinty loop i guess and lots o new, same enterys in the txt file. i got stuck here and wonder if someone could help .... this is my code .... <?php $text = $_GET['email']; $text1 = $_GET['sex']; $text2 = $_GET['age']; $dates = date("d.m.Y H"); $savestring = "\n" . $dates . ";" . $text . ";" . $text1 . ";" . $text2 ; $fp = fopen("myFile.txt", 'r'); while (!feof($fp)) { $line = fgets($fp); if(strcmp($savestring,$line)==0) { echo "<h1>Duplicate entery.</h1>"; fclose($fp); } else { fclose($fp); $fp1 = fopen("myFile1.txt", 'a'); fwrite($fp1, $savestring); echo "<h1>Success. U have been added to list.</h1>"; } } ?>
×
×
  • 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.