synking Posted September 6, 2012 Share Posted September 6, 2012 Hey everyone. Thought i would ask on here cuz i don't seem to be understanding it. I am trying to setup a system where people input ideas to improve a project. Each idea is supposed to go through certain stages of approval or denial. I have one table that store all the ideas. which looks like DESCRIBE ideas; +----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+----------------+ | Id | int(5) | NO | PRI | NULL | auto_increment | | Date | date | NO | | NULL | | | Email | varchar(255) | NO | | NULL | | | Name | text | YES | | NULL | | | Headline | text | YES | | NULL | | | Problem | text | YES | | NULL | | | Promise | text | YES | | NULL | | | Proof | text | YES | | NULL | | | Threats | text | YES | | NULL | | | Passion | text | YES | | NULL | | | Cost | text | YES | | NULL | | | Value | text | YES | | NULL | | | Purpose | text | YES | | NULL | | +----------+--------------+------+-----+---------+----------------+ 13 rows in set (0.01 sec) Which i am trying to assign a foreign key too so that the status of them can be related to a seperate table. But my issue is im not sure if that is the best way to do it... Should i just add another column to this table for the status and not worry about creating a second table. If i do create a second table what is the best way to handle the foreign key relationship. Just trying to get ideas thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/268067-foreign-key-explination/ Share on other sites More sharing options...
xyph Posted September 6, 2012 Share Posted September 6, 2012 I'd probably just add another column myself... But 'status' for me is usually limited to 'Complete', 'In Progress', or 'Not Started' It really depends on how flexible you need to be with your status. Generally, if you only have a few different options it's not worth it to move over to a foreign key. Quote Link to comment https://forums.phpfreaks.com/topic/268067-foreign-key-explination/#findComment-1375790 Share on other sites More sharing options...
synking Posted September 6, 2012 Author Share Posted September 6, 2012 Ah ok that makes sense yeah there are 5 steps that it can be in... Technically 4 since they all start in the pending status that then move to 4 steps. I will just add the column to the already exsisting table thanks. Quote Link to comment https://forums.phpfreaks.com/topic/268067-foreign-key-explination/#findComment-1375794 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.