Exclude Similar Data from Tables of MySQL ?

Discussion in 'PHP' started by Axus Technologies Inc., Nov 25, 2009.

  1. #1
    Hi..

    I have a Free gift form on my site and users use to submit the form and then we just just EXPORT them as CSV on the backend and process all the free gift orders.

    But now, ppl have started tricking us by entering the addresses this way,

    132 north main street Apt #16
    132 main street north Apt #16
    132 N main st Apt #16
    132 N main #16
    132 N main #16a
    132 N main #16b
    132 N main #16c
    132 N main Apt #16
    132 N main Apt 16
    132 N main st #16
    132 N main Rd Apt #16
    132 N main Ave Apt16



    They trick us entering this same address multiple times and we end up sending the gift to that same address that many times and there is a huge loss of funds here.


    So, we need a solid solution now.
    We need that, there should be something on the backend, by which, we can just click and it checks that whole table in the database , which corresponds to that TEXT AREA field ( address ) output to the database .

    And excludes all such tricky similar data .

    So that, then we can just click on EXPORT CSV and and it downloads the CSV without those excluded data.

    So, how can we get this done friends ?
    We are really stuck on this .
     
    Axus Technologies Inc., Nov 25, 2009 IP
  2. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #2
    You should handle this on the front in, not the back end--don't even allow duplicates into the database. Check for duplicates when they submit the form, if you find one, thell them that their information is a duplicate and you don't allow it.

    As for actually identifying duplicates, you need to define what a duplicate is. What other information do you collect about the submitter? You need some data that will identify each row of the database as distinct from any other. If you collect email addresses that would be a good field to use. You can also log the user's IP address when they submit the form.

    A method I have used when I didn't have one rock solid field to identify dupes is to make a unique string from random pieces of multiple fields. For example, I would take the first characters from the first name, last name, address, city and zip and make it one long string. So this data:

    'William', 'Robertson', '21 West 3rd Street', 'Chicago', 'IL', '60037'

    Turned into this 'WillRobe21 WChic6003', which I used to match other records. Its not perfect, but it will help.
     
    plog, Nov 25, 2009 IP
  3. Axus Technologies Inc.

    Axus Technologies Inc. Peon

    Messages:
    599
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    IP is a good idea, but what if the same person submits it from Cafe and then from his Home ?
    Also, what if different persons, but with same internet connection and static IP ?

    Its going to kill then..
     
    Axus Technologies Inc., Nov 25, 2009 IP
  4. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #4
    That's why I would use the string concatenation method. Select various parts of different fields and build a unique identifier for each record.
     
    plog, Nov 25, 2009 IP