mike12255 Posted January 21, 2011 Share Posted January 21, 2011 Im creating a token system where if a user uploads notes they get tokens and can download other peoples notes. My problem is I am not sure where to store the information for who has bought the note for future download. Should I store the information in the database under the table that looks after the notes, in its own table, or in a file that has arrays of the Note names and the users who are allowed to download it. I figured the best way would to have it in the db table that looks after the users but im not sure how I would get about making it so that every time the user bought another note I didnt have to add a new field. Quote Link to comment Share on other sites More sharing options...
freelance84 Posted January 21, 2011 Share Posted January 21, 2011 Have one field for the "tokens" Upon adding note to site: increment the value in the said field by one Upon downloading: do the opposite Quote Link to comment Share on other sites More sharing options...
mike12255 Posted January 21, 2011 Author Share Posted January 21, 2011 yes I understand that part and actually have it working right now. My issue is say the user loses the note, I want them to be able to visit their profile and redownload and previously purchased notes. However Im not sure how to go about storing the information that they have purchased note X. Quote Link to comment Share on other sites More sharing options...
freelance84 Posted January 21, 2011 Share Posted January 21, 2011 ah... i see. You could have a "users_downloaded" table. Could simply start by having two fields, user ID and downloaded_note. Then if the user downloads the note and loses it, you only have to search the above table and return all the users notes... you could add more info of course like where they got it from date added...etc ____________________ Otherwise you would have to create a mapping system for each note added: The notes table has userID, noteNumber, note. Then when user '789' downloads note '17' from user '123', you only need to store 17 and 123 instead of the whole note. Quote Link to comment Share on other sites More sharing options...
mike12255 Posted January 21, 2011 Author Share Posted January 21, 2011 thanks a lot i really didnt think of something like that at all. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.