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  »  Filters not working

phpMyEdit General     Filters not working
Post new topic   Reply to topic    
 
Arpa     Joined: 17 Sep 2006   Posts: 3  
Post Posted: 2006-09-17 01:20
Back to top  Reply with quote     

I haven't been able to make my filters work (in versions 5.5 and new 5.6)

my current def:

Code:
$opts['fdd']['ttunnus'] = array(
  'name'     => 'Teki',
  'select'   => 'T',
  'maxlen'   => 3,
  'default'  => '0',
  'required' => true,
      'values' => array(
      'table' => 'pelaajat',
      'column' => 'tunnus',
      'filters' => 'joukkue = 2',
      'description' => 'nimi',
      'orderby' => 'etu'),
  'sort'     => true
);

the result is:

Column 'joukkue' in on clause is ambiguous
and query:

Code:
SELECT PMEtable0.maaliid AS qf0,PMEjoin1.onimi AS qf1,PMEtable0.otteluid AS qf1_idx,PMEjoin2.nimi AS qf2,PMEtable0.ttunnus AS qf2_idx,PMEjoin3.nimi AS qf3,PMEtable0.stunnus AS qf3_idx,PMEtable0.minuutti AS qf4,PMEjoin5.kuvaus AS qf5,PMEtable0.ttid AS qf5_idx,PMEtable0.kuvaus AS qf6 FROM maalit AS PMEtable0 LEFT OUTER JOIN pmp.ottelut AS PMEjoin1 ON (PMEjoin1.otteluid = PMEtable0.otteluid AND kausi = 2006) LEFT OUTER JOIN pmp.pelaajat AS PMEjoin2 ON (PMEjoin2.tunnus = PMEtable0.ttunnus AND joukkue = 2) LEFT OUTER JOIN pmp.pelaajat AS PMEjoin3 ON (PMEjoin3.tunnus = PMEtable0.stunnus) LEFT OUTER JOIN pmp.tekotapa AS PMEjoin5 ON (PMEjoin5.ttid = PMEtable0.ttid) ORDER BY PMEtable0.maaliid


I can make the list page work is I use $jointable or PMEjoin3 in the filter. But then the edit/add page doesn't work.

btw the 5.5 version didn't give me any errors but any filters didn't work either so I think 5.6 "fixed" filters in joins? But there's still something to fix I quess?

 
michal     Joined: 17 Jun 2003   Posts: 537   Location: Slovakia
Post Posted: 2006-09-18 13:10
Back to top  Reply with quote     

try 'filters' => '$join_table.joukkue = 2',
or 'filters' => 'PMEjoin2.joukkue = 2',

 
Arpa     Joined: 17 Sep 2006   Posts: 3  
Post Posted: 2006-09-18 23:20
Back to top  Reply with quote     

michal wrote:
try 'filters' => '$join_table.joukkue = 2',
or 'filters' => 'PMEjoin2.joukkue = 2',


List page works but add page gives

Code:

MySQL error 1109
Unknown table '$join_table' in where clause


I got the impression the 'filter' line would not work on list page only edit/add pages? obviously I'm wrong or misunderstood something...

 
michal     Joined: 17 Jun 2003   Posts: 537   Location: Slovakia
Post Posted: 2006-09-19 09:40
Back to top  Reply with quote     

yes, 'filters' is in add/change modes.

in other modes, there is 'join' option (with similar configuration).

 
Arpa     Joined: 17 Sep 2006   Posts: 3  
Post Posted: 2006-09-19 14:45
Back to top  Reply with quote     

michal wrote:
yes, 'filters' is in add/change modes.

in other modes, there is 'join' option (with similar configuration).


Thanks, unfortunately I just can't make it work in both list and add page at the same time.

If I make the filter work on add page (by adding pelaajat.joukkue=2 to $opts['fdd']['ttunnus']['values']['filters'] = 'pelaajat.joukkue = 2';) then it doesn't work on list page (unknown table pelaajat)

Combinations of $join_table etc. have all been unsuccessfull.

So what I can understand is that using ['join'] should make my list join only certain values, and ['values']['filters'] should display only a selection of rows in edit/add page right? They should not work on both pages at the same time?

here my current setup:

Code:

$opts['fdd']['ttunnus'] = array(
  'name'     => 'Teki',
  'select'   => 'T',
  'maxlen'   => 3,
  'default'  => '0',
  'join'     => '$main_table.kausi = 2006',
  'required' => true,
  'sort'     => true
);
$opts['fdd']['ttunnus']['values']['table'] = 'pelaajat';
$opts['fdd']['ttunnus']['values']['column'] = 'tunnus';
$opts['fdd']['ttunnus']['values']['filters'] = 'pelaajat.joukkue = 2';
$opts['fdd']['ttunnus']['values']['orderby'] = 'suku';
$opts['fdd']['ttunnus']['values']['description']['columns'][0] = 'etu';
$opts['fdd']['ttunnus']['values']['description']['divs'][0]    = ', ';
$opts['fdd']['ttunnus']['values']['description']['columns'][1] = 'lempinimi';
$opts['fdd']['ttunnus']['values']['description']['divs'][1]    = ', ';
$opts['fdd']['ttunnus']['values']['description']['columns'][2] = 'suku';


and result is:

MySQL error 1109
Unknown table 'pelaajat' in on clause
MySQL error 1109
Unknown table 'pelaajat' in on clause
phpMyEdit error: invalid SQL query
SELECT PMEtable0.maaliid AS qf0,PMEjoin1.onimi AS qf1,PMEtable0.otteluid AS qf1_idx,CONCAT(PMEjoin2.etu,", ",PMEjoin2.lempinimi,", ",PMEjoin2.suku) AS qf2,PMEtable0.ttunnus AS qf2_idx,PMEjoin3.nimi AS qf3,PMEtable0.stunnus AS qf3_idx,PMEtable0.minuutti AS qf4,PMEjoin5.kuvaus AS qf5,PMEtable0.ttid AS qf5_idx,PMEtable0.kuvaus AS qf6 FROM maalit AS PMEtable0 LEFT OUTER JOIN pmp.ottelut AS PMEjoin1 ON (PMEjoin1.otteluid = PMEtable0.otteluid AND PMEjoin1.kausi = 2006) LEFT OUTER JOIN pmp.pelaajat AS PMEjoin2 ON (PMEjoin2.tunnus = PMEtable0.ttunnus AND pelaajat.joukkue = 2) LEFT OUTER JOIN pmp.pelaajat AS PMEjoin3 ON (PMEjoin3.tunnus = PMEtable0.stunnus) LEFT OUTER JOIN pmp.tekotapa AS PMEjoin5 ON (PMEjoin5.ttid = PMEtable0.ttid) ORDER BY PMEtable0.maaliid

 
webmasterextraordinaire     Joined: 25 Apr 2006   Posts: 5  
Post Posted: 2007-01-25 00:56
Back to top  Reply with quote     

Bumpage!

I'm having this exact problem and the last post is a bit discouraging in regards to there being a solution.

Maybe someone's found something since this thread was started?

My specific code:

$div == division code for the application user.

$opts['fdd']['forklift'] = array(
'name' => 'Forklift',
'select' => 'T',
'maxlen' => 25,
'sort' => true
);
$opts['fdd']['forklift']['values']['table']='assets';
$opts['fdd']['forklift']['values']['column']='code';
$opts['fdd']['forklift']['values']['description']='code';

The above works fine, however, if I add the following:

$opts['fdd']['forklift']['values']['filters'] = "PMEjoin2.whsnum = '$div'";

I get the following error in add/change mode:

MySQL error 1109
Unknown table 'PMEjoin2' in where clause

On the other hand, if I reference the table directly:

$opts['fdd']['forklift']['values']['filters'] = "assets.whsnum = '$div'";

I get

MySQL error 1109
Unknown table 'assets' in on clause

this occurs on the main field listing page.

Halp!

 
webmasterextraordinaire     Joined: 25 Apr 2006   Posts: 5  
Post Posted: 2007-01-25 22:47
Back to top  Reply with quote     

I rolled back to version 5.5 and it works fine.

 
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