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();
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.
Need some help.
We have installed and working on UserFrosting. In this we have 2 tables one for USER and another for CUSTOMER. So the thing that we want to achieve, want to provide a option from which we can assign a customer in USER.
For this we have created 3rd table where we want to make relationship between USER and CUSTOMER.
The issue is, we want to save Customer id in the 3rd table with User's id. So basically in 3rd table we will show user id and associated customer's id.
So please suggest.
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.
I want to allow users to enter up to 5 tags tag like a company name, or charity their associated with. When a user clicks on that tag, it will take them to a page with all the users associated with that tag.
example: If somebody enters CBS, it will show all users associated with CBS.
I know I can add a unique index to keep users from entering duplicate content like stated here , but won't that keep users from being able to enter a company they are associated with if it already exist in the database.
I don't wan't duplicates in the database, but do wan't to allow users the choice to pick companies that may already exists in the database submitted from other users.
This database will hold only data submitted from the users.
I am using larval 5
my database looks like this:
Users
id|username|email
Tags
id|tags
usertags
id|userId|tagId
You can use the validate in request file of laravel
Use Unique based on the tag(and/or)comment & user id
It will help you to get data what you are expecting
refer laravel document also
I'm looking for guidance on the database structure for a multi-regional website.
I am setting up a website, similar to craigslist.com, that will allow users to post adds in their city. I am using a MySQL database.
I want to have regions as subfolders linked to subdomains e.g. ca.mysite.com goes to mysite.com/ca.
My question is how do I manage the database(s) when I want to add another city to my website.
If I use a different database for each city, then users wont be able to login to other cities as their login details are stored in the city they registered at in the users table of it's db.
This may not be an issue though, as the content is city specific, like craigslist.
But, should they wish to contact users in other cities, they wont be able to.
Also, there would be duplicate username's and email addresses overall, as users could register in all of the cities using the same email and username.
If I create a central database with for instance, a users table, and a messages table, and then a separate db for each city with all that cities 'posts' then when displaying basic information I will need to consult the city specific db plus the central db that stores user info.
Alternatively I could store everything on one database, and store the logged-in user's location in a cookie, pass that to a session variable, and use that location as part of the database query when displaying search results etc.
However, would this not add an unnecessary overhead to each query?
e.g. every search would have to have ' AND location = $user_location ' added in.
I really have no idea what would be the best method here.
Thanks in advance for any help on this.
It seems that you still do not know clearly the system you want to build. Before starting designing a database for this system, please make sure that you have the full description of the system requirements. Some sample questions that help you clarify are:
What features does your website offer?
What are all the actions that a user using your system can do? With each action, is there any restrictions?
Some other questions relating to the system performance:
- How many users do you expect to use your system?
- How fast and correct each action should be served? Which actions are used frequently?
It makes no sense to design a system without a careful understanding about the system requirements.
So here is the sample database design and how it can support your requirements.
Cities(cityid, cname)
Users(userid, fname, lname, cityid, currcityid)
Messages(mid, senderid, receiverid, content)
Adverts(aid, title, content, userid, cityid)
When a user switches the city, update the currcityid field in its row in the Users table.
When a user posts an ad on a city, insert a new row to the Adverts table. The userid and cityid of the new row are the ids of the corresponding user and city.
When a user sends a message to another user in the system, add a row to the Messages table. The senderid and the receiverid of the new row are the ids of the corresponding users.
Query all ads in a city: SELECT * FROM Adverts WHERE cityid = $cityid
Query all ads of a user: SELECT * FROM Adverts WHERE userid = $userid
Query all ads of a user in a specific city: SELECT * FROM Adverts WHERE cityid = $cityid AND userid = $userid
Hope this helps.