This topic is locked

Make details table drop down dependent on Master table

9/3/2014 1:43:19 PM
PHPRunner General questions
P
p1nr author

I am creating a system where users select a vendor when creating a new record. A list of items will then show on the details page based on the selected vendor. I am having difficulties making the details drop down dependent on the master table. I've tried using $_SESSION in my where statement but nothing.
Any help?

Sergey Kornilov admin 9/3/2014

You can use $_SESSION["<table name>_masterkey1"] to access the value of master table primary key value. More info:

http://xlinesoft.com/phprunner/docs/phprunner_session_variables.htm

P
p1nr author 9/3/2014



You can use $_SESSION["<table name>_masterkey1"] to access the value of master table primary key value. More info:

http://xlinesoft.com/phprunner/docs/phprunner_session_variables.htm


Thank you, it's not a master key unfortunately it can't be a master key. Any other methods to obtain values?

Sergey Kornilov admin 9/3/2014

This variable contains the value of link field from the master table (usually a primary key from the master table but can be any field of your choice).
If you need to access any other field from master table - perform a SQL query to retrieve the whole master record, save results in session variables and access it anywhere you need.

P
p1nr author 9/3/2014



This variable contains the value of link field from the master table (usually a primary key from the master table but can be any field of your choice).
If you need to access any other field from master table - perform a SQL query to retrieve the whole master record, save results in session variables and access it anywhere you need.


I don't suppose you have literature on this do you?

Sergey Kornilov admin 9/3/2014

We have the whole PHPRunner manual that covers similar questions (executing SQL queries in events, using session variables etc). The problem is that your question is a bit vague and providing a meaningful answer is difficult.
My personal suggestion though is to use built-in means for this task. Instead of using master-details relationships and filtering data manually use dependent dropdwons boxes. This way data in secondary dropdown box will be filtered automatically.