This topic is locked

Master Detail with multiple IDs

11/30/2006 9:52:56 AM
PHPRunner General questions
I
itxlieni author

Hello
I have 2 Tables users and groups..

In the user Table i have a field groups with possibility to enter more than one group,

like groups (2,6,16).
What can I do to show only records from the second group (6)?

With the Users in Group (2) it works fine, with other groups after a (,) it doesn't work.
Any idea???

Alexey admin 12/5/2006

Hi,
you'll need to change the filter criteria in details table from this one:

where groups='6'

to something like this:

to > where (groups='6' or groups like '6,%' or groups like '%,6,%' or groups like '%,6')


To do this modify generated details ..._list.php file.

Find this line there:

$where.= GetFullFieldName("groups")."=".make_db_value("groups",$_SESSION[$strTableName."_masterkey1"]);



and replace it with the following:

$mkey=$_SESSION[$strTableName."_masterkey1"];

$where.= "(groups='".$mkey."' or groups like '".$mkey.",%' or groups like '%,".$mkey.",%' or groups like '%,".$mkey."')";