I HAVE REWRITEN MY QUESTION:
-----------------------------
I have a database with 30,000 records... I show them in DESC order so that the most recently added record shows up first.
When I log in and go directly to VENDOR LIST, the newest record shows up (example: VendorID = 30000).
In a related table I store all of the past years that they have done business with us. (Year = nnnn).
When I view the Vendor, I want to search for Max(Year) to find the last time (year) that they did business with us.) I use the BEFORE SHOW LIST Event[size="4"][/size] to do this.
My query looks like this:
$query = SELECT MAX(Year) FROM mastertable WHERE VendorID = ".$_SESSION["mastertable"."_masterkey1"];
But this doesn't work. There is no masterkey1.
My question is:
[size="5"]"What record-variable do I use to identify the first record that shows up (VendorID=30000) so that I can pull other data from their tables?"[/size]
.
.
.
.
.
.
=======PREVIOUS VERSION OF THIS QUESTION========================
I tried to use
print_r ($_SESSION["mastertable"."_masterkey1"]);
in Before List Page is Displayed but it comes back "blank".
The detail table works okay.
print_r ($_SESSION["detailtable"."_masterkey1"]);
So, I've finally realized that the MASTERKEY1 doesn't get assigned until a detail table is displayed. Right?
What can I use on the very first displayed record as that record's session identity? The VendorID is the record's key field.
SAMPLE BAD QUERY
$query = "SELECT MAX(Year) FROM mastertable WHERE VendorID = ". $_SESSION["mastertable"."_masterkey1"];