How to structure a simple database
-
I would like to construct a database of the following nature: There are different types of people, and each person does many jobs, example: cleaner: clean toilet, clean kitchen maid: do laundry, cook breakfast, cook lunch gardener: plant flowers, water flowers I will also have a MySQL database with all of the cleaners, maids, gardeners, etc. The user will write which job he needs into an HTML form and then the PHP file will determine who does the desired job and then select the most appropriate person for the job. How do I structure the above database? Do I do it just as I did above? How does PHP "put them together"? Must I use arrays? Should I put this database directly into the PHP code or in a separate text file (or other kind of file)? Thanks everyone!
-
Answer:
As indicated in the other post, you need to learn basics before you dive into something complicated. There are ample tutorials on web which are easy to understands and get started with. You may start with http://www.blazonry.com/scripting/linksdb/start.php to get a grasp of working with MySQL and PHP, and then you can use the following schema for your web-application. people people_id (PK) name roles role_id (PK) role_name tasks task_id (PK) role_id (FK) task_desc people_roles pr_id (PK) people_id (FK) role_id (FK) people -- all the employees/people and their details roles -- all the available roles tasks -- tasks that each role is assigned, role and task has one to many relationship (see the FK?) people_roles -- this is a link table that makes may-to-many relation ship between people and roles, so that a gardener can be act as a cook. If you wish to assign so. Hope this helps.
James at Stack Overflow Visit the source
Other answers
You need to learn to walk before you can run. I would do some basic PHP/MySQL tutorials first to get yourself familiar with the very basics of data manipulation. Then maybe to speed up production use a framework, http://www.cakephp.org would by my recommendation based on it's powerful auto-magic CRUD (Create, Read, Update, Delete - something else to read up on :) ).
Dunhamzzz
Related Q & A:
- how to process a simple loop in WWW::Mechanize to be more efficient?Best solution by stackoverflow.com
- How to make a simple Facebook canvas app?Best solution by Stack Overflow
- How to do a simple character controller?Best solution by Stack Overflow
- How to create a simple counter program?Best solution by Stack Overflow
- How to create a simple Facebook status update Application?Best solution by ilovefreesoftware.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.