This topic is locked

Master-Detail Question

12/3/2005 7:05:40 PM
PHPRunner General questions
D
defcon2000 author

Hi,
I am new to PHP runner as well as PHP itself.
Question 1

I have 2 tables Master & Detail. I would like to have one of he fields that loads from a master record to be automatically inserted into one of the detail fields. How can you help?
Question 2

What and where can I put in PHP runner so that when a master record is delete, all child records are deleted too?
Question 3

What and where can I put in PHP runner so that when a master record is delete, all child records are deleted and for each of those child records other sub-child records are deleted (meaning, there is a master-detail-subdetail)?
Thanks in advance for your help.
Rgds,

D
defcon2000 author 12/5/2005

Is there anyone with an answer for me?

Sergey Kornilov admin 12/6/2005

Hi,

  1. you can do the following to fill your detail table field automatically:
    Select Detail Table in PHPRunner and open Formatting tab. Enter
    @$_SESSION["mastervalue"]


as a default value for field you want to fill automatically.
Ensure that you checked off Display Master table info box on Datasource table tab in PHPRunner.

Build the pages.
Open generated ..._list.php file for a detail table with a text editor, locate the following snippet:

if($rsMaster)

More...

{

$data=db_fetch_array($rsMaster);



and insert the following line just after it:

$_SESSION["mastervalue"]=$data["Field"];


where Fieldis the exact field name in your master table.
2-3. Deleting detail record automatically is not possible. Usually this being on the database using triggers.