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  »  querying from one table into another wth multiple conditions

phpMyEdit General     querying from one table into another wth multiple conditions
Odoslať novú tému   Odpovedať na tému    
 
kro33     Založený: 08.11.2007   Príspevky: 5  
Príspevok Zaslal: 2007-11-08 06:00
Návrat hore  Odpovedať s citátom     

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     Založený: 08.11.2007   Príspevky: 5  
Príspevok Zaslal: 2007-11-11 01:24
Návrat hore  Odpovedať s citátom     

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     Založený: 08.11.2007   Príspevky: 5  
Príspevok Zaslal: 2007-11-11 16:14
Návrat hore  Odpovedať s citátom     

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

Kód:

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:
Kód:

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


 
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