Welcome Guest, Not a member yet? Register   Sign In
Selecting from database, question.
#3

[eluser]vivar[/eluser]
Agreed. You may find it useful to create a "lookup" table that holds the various status types (ie. create a status table with columns: id (PK), name).

The PK of this 'status' table (ie. id) can be used as a FK in a table that requires a status_id (ie. the 'posts' table references the column 'id' of the 'status' table). Then, as Jondolar pointed out, you can rename a status in the future without breaking your code and if you need to display the status name (ie. 'approved') you can get the name from the status table using a simple SQL join.


Messages In This Thread
Selecting from database, question. - by El Forum - 02-22-2010, 01:13 PM
Selecting from database, question. - by El Forum - 02-22-2010, 01:48 PM
Selecting from database, question. - by El Forum - 02-22-2010, 03:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB