Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  simple table join with primary key by virtual field

phpMyEdit General     simple table join with primary key by virtual field
Post new topic   Reply to topic    
 
themanthing     Joined: 24 Dec 2009   Posts: 5  
Post Posted: 2010-04-07 13:01
Back to top  Reply with quote     

Hi all, i can describe the working solution, how it makes to join tables by primary key. Sorry for bad english)

We have: 2 tables,

"main" :
| main_id | gi_sname | city |
-------------------------
| 1 | blab | t1 |

"main_en" :
| main_id | gi_sname |
-------------------------
| 1 | trututu |

We want to show result table, join by main_id (primary key) :
| blab | trututu | t1 |

We can join it simple by adding virtual field:
Code:

$opts['fdd']['main_id'] = array(
  'name'     => 'Main ID',
  'select'   => 'T',
  'options'  => 'AVCPDR', // auto increment
  'maxlen'   => 10,
  'default'  => '0',
  'sort'     => true
);
$opts['fdd']['gi_sname'] = array(
  'name'     => 'Name',
  'select'   => 'T',
  'size' => 150,
  'size|F' => 80,
  'maxlen'   => 255,
  'sort'     => true
);
$opts['fdd']['virt'] = array(
  'name'     => 'English Name',
  'select'   => 'T',
  'input'   => 'V', // virtual
  'options'  => 'L', // list only
  'size|F' => 50,
  'values'   => Array('table' => 'main_en', 'column' => 'main_id', 'description' => 'gi_sname','join' => '$main_table.main_id = $join_table.main_id'),
  'sql'      => 'PMEjoin2.gi_sname',
  'sort'     => true
);


We don`t need to modify 'main_id' field and we can successfully edit all fields! (in other solutions we can`t do this)

 
gargola     Joined: 22 Apr 2010   Posts: 1  
Post Posted: 2010-04-22 19:46
Back to top  Reply with quote     

Hi,

I have multiple tables with data I would like to modify in 1 page.
I read your example, but my data is not linked through a persistent ID:

For example (simple)

Table|Key|Field1|Field2|Field3

Member|MemberID|FirstName|LastName|Place
Branch|BranchID|Location
MemberBranch|MemberID|BranchID

What I want to do, is to be able to edit the Branch of a Member in the same mask in which I edit the member as such.

Kind regards,
gargola

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy