Login Retreive lost passwordRegister
Search

Manual  /  Functions  /  Database Functions  /  addJunctionTable

(Since version FH3 v1.2.11)

addJunctionTable
addJunctionTable (
string $sTable
string $sDestinationField
string $sSourceField
)

Arguments:

Name Description
$sTable The name of the junction table
$sDestinationField Foreign key to the table
$sSourceField Foreign key to the id of this form

Description:

Add a table and the fields for a junction table
Makes it possible to save data in a junction table instead of comma-separated values.

Example

<?
$oForm 
= new dbFormHandler();
$oForm->dbInfoDB_NAME'table'DB_TYPE );
$oForm->dbConnectDB_HOSTDB_USERDB_PASS );

$oForm->textField'Name''name' );

// get items from an other table as checkbox
$oForm->dbCheckBox'Select items''item_id''tbl_items', array( 'id''item' ) );

// add the junction table
$oForm->addJunctionTable'tbl_table_has_item''item_id''table_id' );

$oForm->onSaved'FH_SAVE' );
$oForm->submitButton(  );
$oForm->flush( );
?>

Latest change: 01 March 10 / 22:03

Comments

powered by PHP-GLOBE   © 2004 - 2024 FormHandler. All rights reserved.   -   Open source license