#1
  1. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,971
    Rep Power
    375

    Storing/using vouchers


    I created a voucher system previously where if anyone registers to my site, they get sent a voucher they can use. In that system I would "delete" the voucher from my table. (Table only had 1 column of voucher).

    I have to create another similar system, I am now wondering IF i should change the table structure to vouchers ( voucher, timestamp, user_email ). This way vouchers will stay in my table and I can get a bit more info). Although this extra info isn't really needed.

    So should i create this new system exactly like before, deleting vouchers after sending them to the user OR make it more "informative".
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Keep the vouchers. If there's a bug, or some member claims they've lost the voucher without using it, you'll at least have some info to investigate the issue. Otherwise, you have literally nothing.

    Actually deleting things is usually a bad idea, especially when you have a proper database layout with foreign keys.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,971
    Rep Power
    375
    thanks (as always). I was leaning towards this but I thought this is "extra work". Yeah you are right, shouldnt delete in general, just use a status & update that with 1 or 0.

IMN logo majestic logo threadwatch logo seochat tools logo