This topic is locked

Master-Detail Relationship

8/30/2005 1:28:08 PM
PHPRunner General questions
J
Jack author

I have a master-detail relationship between 2 tables. I want to edit a field (not the key field), in the detail table using the lookup wizard. I would like to limit my choices in the lookup table to correspond to a field value (not the key field), in the master table. What is the php syntax that I need in the "Where" box of the lookup wizard.
Thanking you in advance,

Jack

Sergey Kornilov admin 9/1/2005

Jack,
let Field_lookup is the field in the Lookup table and Field_limit is the field in the Master table.
Then enter this expression in the WHERE box in the Lookup wizard settings dialog:

"Field_lookup = ".$_SESSION["limit"]


or this one

"Field_lookup = '".$_SESSION["limit"]."'"


if your field has text format.
Build the project.

Open ..._list.php file for details table by any text editor and find the following code snippet:

if($rsMaster)

{

  $data=db_fetch_array($rsMaster);


Add this line right after it:

$_SESSION["limit"]=$data["Field_limit"];