StroiX Posted March 29, 2008 Share Posted March 29, 2008 As you can guess, I am new to database programming and desperately need advise. I have three tables, "Account", "Admin" and "Report". Table "Account" will be used to store the customers information at the time of sign-up. "Admin" will be used to store information of the few chosen admins that will have access to the information stored in "Report" via a web page. "Report" table will be used to save the reports that will be submitted by users. I am wanting to give user (submitting the report) the option to remain anonymous and was thinking, instead of having a unique user_id, maybe I should just have report_ids and the "Report" table will be used to store information about the user if they chose to provide it otherwise the report_id will be used to reference the report and anything else submitted by users (this model is what I am using right now). Users will also pick a password to access their account, and then that "account" will become their "report id" therefore accessing only one report at a time, hence the user may have several "accounts" if more than one report is submitted. If this is confusing please let me know so I can better explain, and please feel free to advise ANY change necessary to make this blueprint better and more efficient for future use. I am in the very beginning state and would appreciate any feedback, especially on how to go about linking the tables, make what primary, etc... Thank you. Link to comment https://forums.phpfreaks.com/topic/98451-database-blueprint-please-advise/ Share on other sites More sharing options...
Barand Posted March 29, 2008 Share Posted March 29, 2008 One way to hack off your users would be to have them create a new account each time they submit a report Id move the account-related items from your report table to the account table and put the account owning the report in the report table as a foreign key. [pre] account report ============== ================= accountID (PK)--+ reportID (PK) company +----- accountID (FK) address type city status state risk_level zip anonymous firstname message lastname email password [/pre] You might also want a date_submitted in the report table. (Thanks for an image instead of text so we can't just copy the column names) Link to comment https://forums.phpfreaks.com/topic/98451-database-blueprint-please-advise/#findComment-503871 Share on other sites More sharing options...
StroiX Posted March 30, 2008 Author Share Posted March 30, 2008 sorry about it being an image, I thought this was actually look neater. Tried copying but it looked messy. Link to comment https://forums.phpfreaks.com/topic/98451-database-blueprint-please-advise/#findComment-504475 Share on other sites More sharing options...
keeB Posted March 30, 2008 Share Posted March 30, 2008 I appreciated the image It looks a lot better than text. This coming from a console junkie. Barand is just an oldie! For tracking of anonymous submissions, I usually just create an Anonymous user and leave it at that. This way you can have proper database design (with FK's, etc) Link to comment https://forums.phpfreaks.com/topic/98451-database-blueprint-please-advise/#findComment-504493 Share on other sites More sharing options...
redarrow Posted March 30, 2008 Share Posted March 30, 2008 The image might look good but dosent help us programmers to alter your code please dont post images so anoying......... Link to comment https://forums.phpfreaks.com/topic/98451-database-blueprint-please-advise/#findComment-504603 Share on other sites More sharing options...
Barand Posted March 30, 2008 Share Posted March 30, 2008 For tracking of anonymous submissions, I usually just create an Anonymous user and leave it at that. This way you can have proper database design (with FK's, etc) it depends on whether a user is always anonymous, or not, or if you want to give users the option of sometimes submitting anonymous reports. In the former case the anon flag would be in the user table, in the latter case it be in the report table Link to comment https://forums.phpfreaks.com/topic/98451-database-blueprint-please-advise/#findComment-504607 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.