defineRelationship
Details
| Type | function | 
|---|---|
| Returns | void | 
Parameters
- dbMainTableFK
 - Foreign key of the main table
 - dbOtherTable
 - Name of the associated table (table you're making a relationship to)
 - dbOtherTablePK
 - Primary key of the associated table (this is the VALUE of the dropdown)
 - dbOtherTableField
 - Field to return for the TEXT in the dropdown
 - (optional) dbOtherTableSortField
 - The name of the field in the associated table you wish to sort by (eg fldSort)
 - (optional) required
 - 0 to make this field not require one of the choices (default) | 1 to require one be selected
 
Example
$tblDemo->defineRelationship("fkOtherTableID", "tblOtherTable", "pkOtherTableID", "fldOtherTableField");
OR (w/advanced features)
$tblDemo->defineRelationship("fkOtherTableID", "tblOtherTable", "pkOtherTableID", "fldOtherTableField", "fldSort", 0, "WHERE fldOtherTableName LIKE 'Libertarian%'");
DISPLAY MORE THAN ONE FIELD:
$tblDemo->defineRelationship("fkOtherTableID", "tblOtherTable", "pkOtherTableID", "CONCAT(fldFirstName, " ", fldMiddleName, " ", fldLastName)")