| Index
» Projects
» phpMyEdit
» Forum
» VERY complex table lookup |
 |
sidonian
Joined: 19 Jul 2003
Posts: 6
Posted: 2003-08-21 22:52
Back to top
Reply with quote
|
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
Joined: 06 Jan 2003
Posts: 320
Location: Phoenix, Arizona (USA)
Posted: 2003-08-22 09:23
Back to top
Reply with quote
|
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
Joined: 03 Sep 2003
Posts: 10
Posted: 2003-09-19 18:53
Back to top
Reply with quote
|
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
Joined: 19 Jul 2003
Posts: 6
Posted: 2003-09-20 22:49
Back to top
Reply with quote
|
Would you mind e-mailing it to me at sidonian@ggms.com? That would be fantastic!
|
|
Post new topic
Reply to topic
|
|
|
|