I would like to create project and following is scenario :
Database tables:
Table first : Company
Table Second :Employee
when superuser create company then i put information in company table like company name, user name and password.
Then with these username and password company login and enter its employee like name, gender , phone no etc plus username and password for employee so that employee can login as well with its employee rights.
confusion is that when superadmin create new company then it enter values in company table and when company create emplyee account then i enter value in employee table. So on login screen how i can check its superadmin, company or employee so that i can get information from that perticular database table.
Can you guys help me to create database for this scenario. how i can manage what should i use join , view or.....
thanks
Your database structure is correct as you're putting relevant information in each table. E.g. Company's data in company table and Employee's data in employee table.
What you need to do is when someone logins from platform add a extra parameter along with credentials for the type of user.
There are couple of solutions for this,
Create two separate pages for Employee and Company's login.
Have single login page for both of the user having selection box for the user type.
Related
I'm trying to make an Address book with different users in which they can log in with their username and password. And they can store the information like contact id, first name, last name, phone etc. I want each user to have his own address book.
Can someone please explain how I create different address book for different users.
Thanks a lot.
Create a database. take a primary id to each user or provide unique id.Then create another table fill the fields that you want(address book).Match the user who logged in and and with that another table(foreign key relationship).
When you login ..it checks with db then allows.After that you have to use insert ,update keywords for further process to put data in db.That particular unique id/primary key is used to fetch the related data(address book fields) of that user.
It is actually not a good question for StackOverflow but I will still roughly explain it to you.
You will need two different tables for this. The first one will be used for login details and the second one will record user's address book.
For example:
Table auth will have 3 columns id, username, password
Table addressBook will have contact id, first name, last name, phone etc and also have one more which will be called userID
Whenever any user eneter the data in addressBook their userID from auth table coloum id will be stored along with it. Now you can display their own data to the users.
If you have anymore question ask in comment here.
I'm having a hard time to create a schema for my CMS. It is a reservation system for hotels/resorts. I have two users and two connected websites, one for the client and the other for hotel/resort owners (CMS). The owners should create his own account and using that account he can add more than one hotels/resorts, the problem is the owner should be able to add an admin or another user that can access his account so that in case he would not be able to update his reservations he can ask his assistant to update the it. My current schema is like this
Users
id
name
bday
age
and other personal details
then..
Hotels
id
user_id
name
rooms
and other details
When the owner logged in to his account Im getting all his hotels using this query:
SELECT * FROM hotels WHERE user_id = <owner id>
Im thinking of just adding another column like (user_id_2) and (user_id_3) in hotels table. but i don't think that's the right way because that would limit the number of admins. What do you guys think?
I have a big problem I have a main master database which stores the admins information like name, no. etc and also a database name .I am liking a new database with every admin and in that database the admin's private data will be saved...like one admin whose name is Jack, his data will be stored in master database now he is linked with new database name'jack' in jack database jacks all private tables and his employee details and so on will be saved ...
now when an employee will log in with mobile no. and password how can I search this because there will be thousand of admin and they are linked with thousand of database in which there will lots of employee associated with them. What is the best technique to search the specific employee with just mobile and password. I was trying that anyhow if I know the admin name then easily i go to his database and fetch his employee details and log in that employee please help me guyz i am working in php and my sql
if you know the admin details you need to use in search box with ajax operation through ajax you need to send the particular employee information i.e., enter into the employee name send ajax through the page ,and getting the employee you need to write a query then you will get particular employee name details. the query is like this .
query is:select(*)from tablename->where('tableusername',fetchusername($username))->get();
okay so I'm developing this website for my capstone class, it's a ticket reservation system. I'm using phpmyadmin on wamp server. My question is, at any point of time many users will be on my website.
They register or login, and according to their status ( being a Director or Audience) they can reserve a number of seats. So suppose if 2 users are on my website, one as a director and the other as an audience. How can I know which user is which?
When they register, the status is stored in the database, but how can I know which user has which status that are both on my website?
Thanks
From my assumption if both User has different user name and password from these information you can find login user status.
I will suggest to create a mapping table of Roles with User.
For example, User, Role and UserRoleMapping Model.
User ( id, username, FirstName )
Role ( id, role )
UserRoleMapping ( user_id, role_id, status )
Here when User makes an registeration, then as per its role create an entry in UserRoleMapping Table.
Then use of the view to display the list of UserRoleMapping, use their id to display their name and role. Make use of filter in tabs for different role by ordering with respect to created datetime.
To make more advance, you can also display the number of success login, login failure, latest login etc.
I'm going to allow companies to register on my website and create job listings.
I'm currently approaching the problem by creating a Company table with Name, Logo and Password fields. Then when a person registers he can say, "I belong to X company"; at this point, I'll request the password written in by the initial registrator. If she/he enters the correct password then he is given permission to create job postings in the name of the company.
Why I'm doing things this way:
If I just put everything inside of the Company table, every new user would have to create an account and I'll have redundant information, CompanyName, Logo, etc.
And if I do things without a password, anyone can post a job opening under a companies name and that's just wrong.
Care to share some input? Am I doing things wrong? How would you do it?
I would do "jobs requests" like Facebook's friend requests and if the user really work in that company, the company manager just has to login and confirm it.
Database Normalization.
Create a separate Users and Companies table. Can one user post for multiple companies? if so, you need a many-to-many relationship (which requires a third table to keep track of the relationships). Otherwise, a one-to-many should work.
You should create two tables:
Company:
- id
- logo
( - name, etc )
User
- id
- companyId (foreign key to Company.id )
- password
( - username, etc. )
This way a User is a child of a Company identified by companyId. Now, if a user logs in, you can identify what company s/he belongs to by finding the Company corresponding with the companyId. Now you have a password per user, and a company per user.
And like Jimmy says, if you need Users to be able to be part of more Company's you would get:
Company
- id
- logo
User
- id
- password
Company_User
- companyId (foreign key to Company.id )
- userId (foreign key to User.id )
in my opinion you should create table like
Employers:
eid(pk)
logo
Username
Password
profile
etc....
JobSeekers:
jid(pk)
Username
Password
etc...
JobPosts:
id(pk)
eid(Fk to Employers.eid)
JobTitle
Specifications....