K
|
keithh0427 2/4/2020 |
I use a single lookup table with all of my options such as you mention along with the languages that I require in my project. The table structure is: |
S
|
Steve Seymour author 2/4/2020 |
I use a single lookup table with all of my options such as you mention along with the languages that I require in my project. The table structure is: CREATE TABLE lookupkey (key int(11) NOT NULL, // autoincrementlanguage varchar(12) NOT NULL,lang_code char(2) NOT NULL,type varchar(50) NOT NULL DEFAULT '', // category of sorts to narrow down what I'm looing forvalue_num int(11) DEFAULT NULL, // use if the lookup value is numericvalue_var varchar(25) DEFAULT NULL, // otherwise, the lookup value is a stringdisplay varchar(100) NOT NULL DEFAULT '', // the value to display to the yserremark varchar(75) DEFAULT NULL, // this is for my own use in case I forgot what I did hereactive enum('N','Y') DEFAULT 'Y' // for me to know if the lookup is currently active in my project. Sometimes, pieces will go inactive when I make some database changes) // use whatever engine you need Then, when I want to lookup something I use: "type = 'yesno' AND active = 'Y' AND language='" . mlang_getcurrentlang() . "'" Hope this helps.
|
![]() |
Sergey Kornilov admin 2/4/2020 |
I don't find it useful. Copying should be avoided at all costs. Everything should be in the database, multiple or single table like @keith0427 suggested. |
S
|
Steve Seymour author 2/4/2020 |
I don't find it useful. Copying should be avoided at all costs. Everything should be in the database, multiple or single table like @keith0427 suggested. Imagine the situation when you need to change the wording of one of those items or add a new one. You will have to find all those lookup wizards in all projects to make this kind of change. Sounds like a nightmare.
|
A
|
acpan 2/4/2020 |
My preference is to keep the lookup tables small and separated in the DB. |