Postback Script - Question - How To track Completed Surveys in MYSQL to user?

Discussion in 'PHP' started by NewTier, Nov 17, 2010.

  1. #1
    How do I track completed surveys to make sure users can't do the same surveys again?

    I'm thinking the postback posts the offer ID

    but I don't understand the structure of the MYSQL database and make sure users can't complete the same offer twice.

    Should I add to the mysql database all Offer ID's completed by the user or something?
    can one cell contain multiple values?
     
    NewTier, Nov 17, 2010 IP
  2. shofstetter

    shofstetter Well-Known Member

    Messages:
    178
    Likes Received:
    7
    Best Answers:
    1
    Trophy Points:
    120
    #2
    have a offers text field in mysql data base.

    when a user completes an offer grab the content of the offer field and append an offer id to it like this
    offerid1:eek:fferid2:eek:fferid3:eek:fferid4
    example:
    ..........mysql stuff
    $complete_offers = $row['offers'];
    $complete_offers .= ":".$offer;

    then update it in mysql

    then you can check wich offers were completed before displaying by exploding mysql field offers into an array using php explode:

    ................... mysql_stuff

    104:116:10:252

    $ar_offer = explode(":",$row['offers']);

    will give you an array

    Array{
    [0] => 104
    [1] => 116
    [2] => 10
    [3] => 252
    }

    then you could use a for each loop or whatever to see if the user had completed the offer before.
     
    shofstetter, Nov 20, 2010 IP
  3. SterlingS

    SterlingS Greenhorn

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    13
    #3
    another way of checking is add completed offer IDs into table and
    for checking, queue for the offerID and check if there are any matches
     
    SterlingS, Nov 21, 2010 IP