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  »  using join in filters

phpMyEdit General     using join in filters
Post new topic   Reply to topic    
 
sagiben     Joined: 27 Jan 2009   Posts: 15  
Post Posted: 2009-12-27 22:55
Back to top  Reply with quote     

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     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2009-12-30 15:41
Back to top  Reply with quote     

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     Joined: 27 Jan 2009   Posts: 15  
Post Posted: 2009-12-30 16:38
Back to top  Reply with quote     

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     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2009-12-30 18:49
Back to top  Reply with quote     

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

 
sagiben     Joined: 27 Jan 2009   Posts: 15  
Post Posted: 2009-12-30 20:01
Back to top  Reply with quote     

doug wrote:
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. :

Code:

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.

 
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