Manage Relational Table, retrieving data for update form fields
Don't know if this is possible via this method, but here goes.
I have a product with several related tables, for each of which i have added manage related tables server behavior.
Slightly more complex than the blue sky example, some related options have an associated price - which is dependent upon its productid, so the price field is in the many to many table.
my insert page is working fine, however, i cannot recover the price in the update page.
looking at the code, it looks like the mrt server behavior creates a block of code called WA DataAssist Pre-Select Relational Table (x) which is used to retrieve the optionid from the table, but i also want to recover the price.
i tried editing the code from
<?php
// WA DataAssist Pre-Select Relational Table 2
$WA_PreSelect_RelationalTable_2 = array();
$WA_connection = $simon;
$WA_table = "tblproductcolour";
$WA_masterKeyField = "ProductID";
$WA_masterKeyType = "none,none,NULL";
$WA_masterKeyValue = "".$_GET['ProductID'] ."";
$WA_masterKeyComp = "=";
$WA_joinedKeyField = "ColourID";
$WA_connectionDB = $database_simon;
mysql_select_db($WA_connectionDB, $WA_connection);
$WhereObj = WA_AB_generateWhereClause(array($WA_masterKeyField), array($WA_masterKeyType), array($WA_masterKeyValue), array($WA_masterKeyComp));
$WA_Sql = "SELECT ".$WA_masterKeyField.", ".$WA_joinedKeyField." FROM ".$WA_table." WHERE ".$WhereObj->sqlWhereClause." ORDER BY ".$WA_joinedKeyField;
$WA_mrtJoinRS = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if (mysql_num_rows($WA_mrtJoinRS) > 0) {
while ($row_WA_mrtJoinRS = mysql_fetch_assoc($WA_mrtJoinRS)) {
$WA_PreSelect_RelationalTable_2[] = $row_WA_mrtJoinRS[$WA_joinedKeyField];
}
}
?>
to
<?php
// WA DataAssist Pre-Select Relational Table 2
$WA_PreSelect_RelationalTable_2 = array();
$WA_connection = $simon;
$WA_table = "tblproductcolour";
$WA_masterKeyField = "ProductID";
$WA_masterKeyType = "none,none,NULL";
$WA_masterKeyValue = "".$_GET['ProductID'] ."";
$WA_masterKeyComp = "=";
$WA_joinedKeyField = "ColourID";
$WA_extraField = "Price";
$WA_connectionDB = $database_simon;
mysql_select_db($WA_connectionDB, $WA_connection);
$WhereObj = WA_AB_generateWhereClause(array($WA_masterKeyField), array($WA_masterKeyType), array($WA_masterKeyValue), array($WA_masterKeyComp));
$WA_Sql = "SELECT ".$WA_masterKeyField.", ".$WA_joinedKeyField.", ".$WA_extraField." FROM ".$WA_table." WHERE ".$WhereObj->sqlWhereClause." ORDER BY ".$WA_joinedKeyField;
$WA_mrtJoinRS = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if (mysql_num_rows($WA_mrtJoinRS) > 0) {
while ($row_WA_mrtJoinRS = mysql_fetch_assoc($WA_mrtJoinRS)) {
$WA_PreSelect_RelationalTable_2[] = $row_WA_mrtJoinRS[$WA_joinedKeyField];
}
}
?>
adding the extra field price, so i can get the field into the 'recordset' , but can't work out how to set the value of my price text field.


