Page 1 of 1

MySql-Controlling Users

Posted: Thu Aug 11, 2011 9:26 pm
by Nexus100
Hi All, many thanks in advance :mrgreen:

I am writing an application for the construction industry which will allow users to create 'Projects' -the app will be FREE to download providing the USER registers the following details which will be stored in a table <TABLE_USER_DETAILS>. When they submit the project to the web server database I will know how to contact them via email etc...

TABLE_USER_DETAILS
First Name
Last Name
Company Name
Email Address

I know there is a USERS table which can hold Username & Password and Permissions but I am not sure how I link the USERS Table to my TABLE_USER_DETAILS (One To One Schema). Basically I want to add a new user to the USER table and grant the correct privileges, then add the rest of the users details in the above table but ensure integrity so there can be NO duplicates.

Any helpers?



So when 'Frank@LocalHost' Logs in I can then reference the USER_DETAILS table so I know

Re: MySql-Controlling Users

Posted: Thu Aug 11, 2011 9:28 pm
by Nexus100
alphxxxxx@purebasic.com or webxxxxx@purebasic.com I guess it is similar to what you guys have going on here with PB download and user account management...Any help much appreciated!

added by Fred please don't post emails, bots will harvest them

Re: MySql-Controlling Users

Posted: Fri Aug 12, 2011 12:51 am
by citystate
the trick to linking tables is making sure you have some information in common between them (this information must be unique to the individual) - perhaps add an extra column in TABLE_USER_DETAILS for Username

Then when Frank@localhost logs in, TABLE_USER_DETAILS tells you that Frank's Username is "MrBig", and from there you can use this info to lookup on USERS to find his password and privileges

most SQL languages incorporate Primary Keys... these are fields that must be unique and allow easy reference to a single record - I gather that the USERS table is pre-existing; if so, username is probably a primary key (after all, the username should be unique). By matching the field Username in both tables, you can ensure a strict 1:1 ratio providing you make sure both fields are unique.

hopefully that helps

Re: MySql-Controlling Users

Posted: Fri Aug 12, 2011 11:33 am
by Nexus100
Thanks Citystate - most helpful!