Index
» Projekty
» phpMyEdit
» Fórum
» Lookup value from second table |
|
Davey
Založený: 31.03.2011
Príspevky: 16777215
Zaslal: 2011-03-31 18:11
Návrat hore
Odpovedať s citátom
|
I've just managed to get the following to pull a Drop-Down list of values from a second lookup table. Can't reply to the original post for some reason, so just mentioning it here in case it helps someone.
Kód: |
$opts['fdd']['sku'] = array(
'name' => 'SKU',
'select' => 'D',
'options|CDVL' => 'CDRVL', // adding |<opts> limits the options setting to only the specified operations (CDV)
'sort' => true,
'values|A' => array(
'table' => 'sku_groups',
'orderby' => 'grp ASC',
'column' => 'grp',
'description' => array('columns' => array('grp','next_id')), // these column fields get concatenated to provide the actual values listed
)
);
|
I have a second table named 'sku_groups', with a 'grp' column and a 'next_id' column. When I Add a new item, the above creates a Drop-Down list containing all 'grp'+'next_id' values to allow me to choose the appropriate group for the item (something like 'ZZ42').
Because of the |A option setting on 'values', it only shows the dropdown on Add page. On other pages it shows it as a read-only textbox.
What I really want to do though
is to format the result of the 'description' concatenation. How could I force it to always return a 3 digit number (eg. ZZ001, ZZ042, etc.)?
(I have a big bump on my head trying to work this out, so any help appreciated.)
|
stanneo
Založený: 03.02.2011
Príspevky: 14
Zaslal: 2011-03-31 22:20
Návrat hore
Odpovedať s citátom
|
thank you for posting,
every working example is valuable, :-)
greetings
stanneo
|
Shilpa111
Založený: 05.04.2019
Príspevky: 1
Zaslal: 2019-04-22 06:40
Návrat hore
Odpovedať s citátom
|
Hello...I am a new user in this forum site.....I have no idea how to edit the general php..anyone please let me know once
ISO 27001 Certification in Dubai
|
Odoslať novú tému
Odpovedať na tému
Choď na stránku 1, 2, 3 ... 1118480, 1118481, 1118482 Ďalší
|
|
|
|