Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 25. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  using join in filters

phpMyEdit General     using join in filters
Odoslať novú tému   Odpovedať na tému    
 
sagiben     Založený: 27.01.2009   Príspevky: 15  
Príspevok Zaslal: 2009-12-27 22:55
Návrat hore  Odpovedať s citátom     

Hi,

I'm trying to implement a dynamic dropdown list that is being updated every time I add a record to a specific table.
I have a table of people and another table for teams,
each person can be only in 1 team,
so I want to remove this person from the dropdown list when I add him to a team, and if I remove him from a team I want to be able to pick him from the list again.

In order to achieve this requirement I thought to use an 'except' statement,
e.g. :
select userid from user1
except
select userid from user2

The result is a data set containing userid's that are only availlable in user1 or in user2. If the userid is availlable in user1 AND user2, then it
won't be availlable in the result.

One of the possible ways to do it in mysql would be

SELECT u1.userid
FROM user1 u1
LEFT JOIN user2 u2 ON u2.userid=u1.userid
WHERE u2.userid IS NULL

The above mysql select query returns the right values, but how do I use it in dropdown list when adding records ?

Thank you,
Sagi.

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2009-12-30 15:41
Návrat hore  Odpovedať s citátom     

Dynamic implementation cannot be achieved with phpMyEdit.

But you might want to review the documentation on triggers, and search forum posts for trigger or triggers, and possibly invent a work-around which meets your needs. Like adding a new field to hold values 0 or 1 which are manipulated by triggers when other actions occur.

 
sagiben     Založený: 27.01.2009   Príspevky: 15  
Príspevok Zaslal: 2009-12-30 16:38
Návrat hore  Odpovedať s citátom     

Hi Doug,

thanks for you answer,
I'm currently trying to implement a solution which will use
a view.
I created a view in my db which holds the values that I need,
but now the problem that I have is to use the 'view' for adding data and the original table for displaying the data.

Is there an easy way to be able to distinguish between those
situations ?

Thanks,
Sagi.

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2009-12-30 18:49
Návrat hore  Odpovedať s citátom     

You will probably need to abandon phpMyEdit and write custom PHP scripts in order to achieve your goal.

 
sagiben     Založený: 27.01.2009   Príspevky: 15  
Príspevok Zaslal: 2009-12-30 20:01
Návrat hore  Odpovedať s citátom     

doug Napísal:
You will probably need to abandon phpMyEdit and write custom PHP scripts in order to achieve your goal.


OK, I managed to solve my issue using phpMyEdit.
I added an if statement for the relevant column, e.g. :

Kód:

if ( $_POST['PME_sys_operation'] == "Add" ){
$opts['fdd']['u_id']['value'] = <use the view table for the values>
}
else {
  <use the original table for the value>
}




Sagi.

 
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