Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  querying from one table into another wth multiple conditions

phpMyEdit General     querying from one table into another wth multiple conditions
Post new topic   Reply to topic    
 
kro33     Joined: 08 Nov 2007   Posts: 5  
Post Posted: 2007-11-08 06:00
Back to top  Reply with quote     

I have two tables, for simplicity say:
clients(id, name, max_price, available_date, location)
products(id, name, price, date, location, more_stuff)

I basically want to be able to click on a row in one table and see the result of a select with a number of conditions on the other table (and vice versa).

For example, if I have client(0, John, 100, 1/1/2008, USA) and I click on that user in the clients table I want to see the products table, but with a filter of the price (<100), date (<1/1/2008) and location (=USA).

How can I define such rules?

 
kro33     Joined: 08 Nov 2007   Posts: 5  
Post Posted: 2007-11-11 01:24
Back to top  Reply with quote     

So I figured I can look for the values in cgi variables inside products.php and apply them in a filter.
So all I need to do now is on the client View page to be able to add a link/button that passes over some of the client fields over. Any ideas how to do that?

 
kro33     Joined: 08 Nov 2007   Posts: 5  
Post Posted: 2007-11-11 16:14
Back to top  Reply with quote     

alright, FYI, I did it like this. for every query that I want to pass I do:

Code:

if (array_key_exists('maxprice', @$_REQUEST) and strlen(@$_REQUEST['maxprice']) ) {
    $filter .= " AND price <= ". @$_REQUEST['maxprice'] ;
}
$opts['filters'] = $filter;


and then in the clients page i added this:
Code:

$opts['fdd']['search']['escape'] = false;
$opts['fdd']['search']['sql|LV'] =
'CONCAT(
    "<a href=\"apts.php?minrent=", minrent,
    "&maxprice=", max_price,
    "\">search</a>"
   )';


 
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