Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Pondelok, 30. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Lookup to 2 fields from another table

phpMyEdit Configuration     Lookup to 2 fields from another table
Odoslať novú tému   Odpovedať na tému    
 
trombone     Založený: 25.07.2007   Príspevky: 2  
Príspevok Zaslal: 2007-07-25 12:04
Návrat hore  Odpovedať s citátom     

Hello to all,

I'm trying to use PhpMyEdit with an existent database in which ther is something like this:

Main table:

Kód:
ID_person    Name    Adress  City
---------------------------------
15           Foo     Bar     56

Cities table:

Kód:
ID_city      Name    Country
----------------------------
56           Brussel BE

By using

Kód:
$opts['fdd']['City']['values']['table'] = 'Cities';
$opts['fdd']['City']['values']['column'] = 'ID_city';
$opts['fdd']['City']['values']['description'] = 'Name';

I can display the name of the city in the main table.
Ok, but I'd like to display also in an adjacent column the letter of the country (not concatenating 'City' and 'Country' in the same column, because I'd like to sort or select by country):

Kód:
ID_person    Name    Adress  City    Country
--------------------------------------------
15           Foo     Bar     Brussel Be



I can't reuse

Kód:
$opts['fdd']['City']['values']['table'] = 'Cities';

with 'Country' as description, because a second call to this array overwrites the first definition, and I get only one column relative to 'City'.

Has someone a proposal for such a request ?

Thanks in advance,

Gauthier

 
michal     Založený: 17.06.2003   Príspevky: 537   Bydlisko: Slovakia
Príspevok Zaslal: 2007-07-25 13:15
Návrat hore  Odpovedať s citátom     

http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.input-restrictions.html#AEN967

 
trombone     Založený: 25.07.2007   Príspevky: 2  
Príspevok Zaslal: 2007-07-26 08:39
Návrat hore  Odpovedať s citátom     

Hello,

michal Napísal:
http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.input-restrictions.html#AEN967


I've read this "Complex table lookup example" in the doc, but its purpose is to join several columns from a foreign table into one column. With my previous example, that could give:

Kód:
ID_person |Name  |Adress |City (country)
------------------------------------------
15        |Foo   |Bar    |Brussel (Be)


But I wish to display several columns from a foreign table in several column, so create columns that don't exist in the main table.

Is it possible ?

 
michal     Založený: 17.06.2003   Príspevky: 537   Bydlisko: Slovakia
Príspevok Zaslal: 2007-08-06 07:54
Návrat hore  Odpovedať s citátom     

that's a little bit harder, do a virtual column in $opts['fdd'] and have 'sql'=>'PMEjoin0.city';

that should do the job

michal

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov