hello
i am new too to the matter but i found a extremely easy way to do this (like you i have been searching for sometime)
lets say u have 2 tables and you want to show or edit values from both tables.
TableA
A_ID
A_FD1
A_FD2
B_ID
A_FD3
TableB
B_ID
B_FD1
B_FD2
B_FD3
TableA is connected to TableB via B_ID
you do this
$opts['fdd']['A_FD1'] = array(
'name' => 'TableA_FD1',
'select' => 'T',
'maxlen' => 20,
'sort' => true
);
$opts['fdd']['A_FD2'] = array(
'name' => 'TableA_FD2',
'select' => 'T',
'maxlen' => 20,
'sort' => true
);
$opts['fdd']['B_ID'] = array(
'name' => 'TableA_B_ID', // TableA.B_ID ref
'select' => 'T',
'maxlen' => 20,
'sort' => true
);
$opts['fdd']['B_ID']['values']['table'] = 'TableB';
$opts['fdd']['TechTypeID']['values']['column'] = 'B_ID';
$opts['fdd']['TechTypeID']['values']['description'] = 'B_FD1';
$opts['fdd']['B_ID'] = array(
'name' => 'TableA_B_ID', // TableA.B_ID ref
'select' => 'D',
'maxlen' => 20,
'sort' => true
);
$opts['fdd']['B_ID']['values']['table'] = 'TableB';
$opts['fdd']['TechTypeID']['values']['column'] = 'B_ID';
$opts['fdd']['TechTypeID']['values']['description'] = 'B_FD2';
AND SO ON... you can call as many fields from tableB as you want ... either in Text Boxes or DropDown
if you have a Ref for TableC in TableA like C_ID you could also call other values from TableC if you like, i just don't know if there is a join limit for conecting tables this way
i will find out soon :)
| ronbob Napísal: |
I'm having problems with the join of two tables. i'm trying to have in table one fields from table two...
can someone explain in a simple way the logic of how to do this with a sample page of such code as i'm getting nowhere on my own.
thanks |
[img][/img]
|