This topic is locked

Master-Detail info on add en edit page

2/17/2009 6:48:53 AM
PHPRunner General questions
E
el_dorito author

Hello,
I have just setup my first PHPRunner application and everything works well. Now that the general eatures are working I'm trying to do some more complicated stuff and have ran into a problem.
General Info about my app

The idea is as follows:

I'm building an online system to manage events and subscriptions. 3-5 times a month we do something with our club. And I want to track which members are subcribed to every event.
This works btw.
Database model

users

user_ID

name,

firstname
Events

event_ID,

name,

startdate,

enddate
registrations

user_ID,

event_ID
this table handles the Many-To-Many relationship between events and users
What am I trying to achieve

On the Userlist and EventsList page I already have this button to show the subcriptions (trough a popupwindow). However If I add/edit/view an Event of User I also want to show a little table with the users that are registered to this event OR in the case of ADD:/EDIT/VIEW users the events that this user has subscribed to.
In other words I want to show the Child Information of the EVENTS or USERS table in the add/edit/view page.
This would be super cool If possible

I would be nice If I could subscribe users to an event if I'm in the edit event view, idem dito for the users view.
All help is welcome.
Best regards

Geert

J
Jane 2/18/2009

Geert,
to show child records on the edit/view pages use custom event (Insert PHP code snippet option on the Visual Editor tab).

Here is a sample:

global $conn, $strTableName;

$str = "select Field1,Field2 from DetailTable where Key=".$_REQUEST["editid1"];

$rs = db_query($str,$conn);

while($data = db_fetch_array($rs))

{

echo "Field1: ".$data["Field1"];

echo "Field2: ".$data["Field2"];

}

T
taumic 2/20/2009

Hallo Jane,
your sample is very helpful, also for me.

I replace Field1 and Field2 with the real fieldnames, DetailTabelle and Key with the real table/fieldnames,

but what do you mean with "EDITID1" ??
Thank you
Michael

J
Jane 2/20/2009

Michael,
editid1 is a parameter in the URL:

tablename_edit.php?editid1=111