This topic is locked

Link to Detail Table from field other than ID field?

9/3/2009 4:51:06 PM
PHPRunner General questions
M
Mandy author

Hallo.

I managed set a master>detail links as follows:
custom view on MasterTable_ID



global $conn;

$str = "select MasterTable_ID from DetailTable where DetailTable_ID=".$value;

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

$data = db_fetch_numarray($rs);

$value = "<A href=\"detail_list.php?mastertable=MasterTable&masterkey1=".$value."\">detail links</A>"


However, I normally don't list the MasterTable_ID and thus want to link from another field. Unfortunately, I have tried without success - is this possible?

Also, I don't want to change the contents in the linked from field. So, instead of having "detail links" as the live link, I want the field object to be the live link.
Thank you

Mandy

Sergey Kornilov admin 9/3/2009

You can set 'View as' type of any other field to 'Custom' and use almost the same code to build and display details link.
Here is an example:
$value = "<A href='detail_list.php?mastertable=MasterTable&masterkey1=".$data["MasterTable_ID"]."'>detail links</A>";