| Index
» Projekty
» phpMyEdit
» Fórum
» filtering problem |
 |
Dusk
Založený: 22.07.2004
Príspevky: 2
Zaslal: 2004-07-22 16:26
Návrat hore
Odpovedať s citátom
|
Hi everybody :)
I'll try to quickly describe my problem:
| Kód: |
//stuff..
include 'functions.php.inc';
session_start();
//other stuff..
$rank = ProtectedAccess('projectactivities'); //sets $_SESSION['rank']
$pid = $_SESSION['pid'];
//bla bla...
if (($rank!=-1) && ($pid!=-1)) $opts['filters'] = "PMEtable0.idProject = '".$pid."'" ;
if ($rank!=-1) $opts['options'] = $_SESSION['rank'];
|
and this works, cause idProject is a field contained in "projectactivities", the table I'm showing, so I get records filtered dynamically as I want.
But if I had to filter by a joined field?
Code is better than words, so:
| Kód: |
if (($rank!=-1) && ($pid!=-1)) $opts['filters'] = "PMEtable0 INNER JOIN project on PMEtable0.idPerson = project.idInterfacePerson WHERE project.idProject = '".$pid."'" ;
|
project: idProject, idInterfacePerson
PMEtable0: idPerson, categoryPerson
...doesn't work.
The obvious problem is that pme puts the 'filters' string in the where clause of the generated query, but there I haven't access to the "project" table.
I think I should join the table somewhere before, but
I don't know where and how. I used 'values' feature for basic joins other times, but here I haven't to visualize anything, I need to filter values by the value of a joined field.
Any workaround?
Sorry for my poor english, writing from Italy :)
D.
(Quick non-relative thing:
I think that it would be great to write a query to phpMyEdit, other that providing only a table name, providing a more complex recordset formed with joins ecc. to work with. But may be that I'm not entered yet in the PME 'spirit' of managing data.
By the way, very useful software, thankyou for developing it)[/code]
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2004-07-23 14:04
Návrat hore
Odpovedať s citátom
|
not sure if i understand your needs, but have you tried 'join' option ? it's a way to add additional where clause to a performed join.
or is it neccessary to have a way to append a string to the end of the query ? i also ran into neccessity for that (due to group by command), so the more people desire this, the earlier/more probably this feature will be included.
|
Dusk
Založený: 22.07.2004
Príspevky: 2
Zaslal: 2004-07-23 15:14
Návrat hore
Odpovedať s citátom
|
| michal Napísal: |
not sure if i understand your needs, but have you tried 'join' option ? it's a way to add additional where clause to a performed join.
|
I'll try.. by the way, for now I did this way
(dirty workaround, I know.. but... it works)
| Kód: |
connettiDB();
$sql = "SELECT idPersona FROM persona INNER JOIN progetto on persona.idPersona = progetto.idInterfacciaProgetto WHERE progetto.idProgetto = '".$pid."'";
$qr = mysql_query($sql);
$filter = '';
while ($row = mysql_fetch_array($qr)) $filter.= " idPersona = ".$row['idPersona']." OR ";
$filter.= " 'x'='y'";
if (($rank!=-1) && ($pid!=-1)) $opts['filters'] = $filter;
|
Bye :)
D.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|