| Index
» Projekty
» phpMyEdit
» Fórum
» VERY complex table lookup |
 |
sidonian
Založený: 19.07.2003
Príspevky: 6
Zaslal: 2003-08-21 22:52
Návrat hore
Odpovedať s citátom
|
I'm dealing with 3 tables:
1. people (id, first_name, last_name, etc.)
2. properties (id, owner_id[id from people], address, etc.)
3. activities (id, property_id[id from properties], description, etc.)
In properties.php I've successfully displayed last_name (from people) in place of the numeric id in the owner_id field.
In activities.php I can display address (from properties) and owner_id (from properties) in place of id for the property_id field. But I can't figure out how to make the owner_id portion display as last_name as in properties.php.
Can this be done?
Below are the options I've set for property_id
$opts['fdd']['property_id'] = array(
'name' => 'Property ID',
'select' => 'T',
'maxlen' => 11,
'default' => '0',
'required' => true,
'sort' => true
);
$opts['fdd']['property_id']['values']['table'] = 'properties';
$opts['fdd']['property_id']['values']['column'] = 'id';
$opts['fdd']['property_id']['values']['description']['columns'][0] = 'address';
$opts['fdd']['property_id']['values']['description']['divs'][1] = ', ';
$opts['fdd']['property_id']['values']['description']['columns'][2] = 'owner_id';
The result is something like, "123 Baker Street, 12" where "12" is a numeric ID from the people table.
I've tried adding options to modify the 'owner_id' portion of this display but I just get errors saying that the field could not be found. Any suggestions?
|
nepto
Založený: 06.01.2003
Príspevky: 320
Bydlisko: Phoenix, Arizona (USA)
Zaslal: 2003-08-22 09:23
Návrat hore
Odpovedať s citátom
|
The only solution is to make two table edit scripts - one for activities and one for properties with single table lookup (in each script) to upper table.
|
bernie95
Založený: 03.09.2003
Príspevky: 10
Zaslal: 2003-09-19 18:53
Návrat hore
Odpovedať s citátom
|
I've posted code to do this on the "Features" forum, under heading "Advanced lookup - joining three tables". I've elaborated the original poster code and developped an unlimited join mechanism.
If you need it I can send you my modified 5.3-based or CVS-based class.
|
sidonian
Založený: 19.07.2003
Príspevky: 6
Zaslal: 2003-09-20 22:49
Návrat hore
Odpovedať s citátom
|
Would you mind e-mailing it to me at sidonian@ggms.com? That would be fantastic!
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|