DwZone Forum DwZone Forum
Welcome to the DwZone-it Forum
 
  FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups  
    RegisterRegister -->   LoginLogin  
Two tables manager  
DwZone Forum Index -> Two tables manager
.
Moderators: AdministratorsModerators 
Hint: For improved responsiveness, use Internet Explorer 4 (or above) with Javascript enabled, choose 'Dynamic' from the View dropdown and hit 'Set Options' to save your changes.
New Topic Search for
 View     Per page     Messages Since 
Messages 1 to 3 of 3 (Total: 3) First |  Prev |  Next |  Last  
 Subject Author Date  
    Two Tables Manager not adding multiple detail entries  
View this persons public profile  KataMitchell   17:41 31 Jan 2017  
 
I am able to insert "master" and 1 "detail" record successfully but not multiple "detail" records. I had to update the demo for Mysqli and it does not work either. Is this issue because of MYSQLI?

Here is my code

Master = Parent and Detail = Child in my code

<?php
//*******************
// Two Tables Manager
//*******************
require_once('../Connections/msql_i.php');
require_once('../dwzTableManager/dwzTableManager.php');
?>
<?php
//*******************
// Two Tables Manager
//*******************
$dwzTwoTablesCounter = 1;
?>
<?php
//*********************************
//* INSERT 2 TABLES
//* http://www.DwZone-it.com
//* Insert behavior
//* Version 1.0.11
//*********************************
$insertTables = new dwzTables();
$insertTables->Init();
$insertTables->SetType("insert");
$insertTables->SetFormName("form1");
$insertTables->SetConn($hostname_msql_i, $database_msql_i, $username_msql_i, $password_msql_i);
$insertTables->SetRedirect("2database-test.php");
$insertTables->SetMasterTable("[email protected][email protected]_i");
$insertTables->SetMasterKey("p_id");
$insertTables->SetMasterCol("name", "name", "text");
$insertTables->SetMasterCol("sku", "sku", "text");
$insertTables->SetMasterCol("price", "price", "int");
$insertTables->SetDetailTable("child");
$insertTables->SetDetailJoin("p-idMaster");
$insertTables->SetRequiredColumn("name");
$insertTables->SetDetailCol("option", "option", "text");
$insertTables->SetDetailCol("option-price", "price", "int");
$insertTables->Execute();
//*********************************
//* INSERT 2 TABLES
//* http://www.DwZone-it.com
//*********************************
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
//*********************************
//* INSERT 2 TABLES
//*********************************
echo "<script src=\"../dwzTableManager/dwzTableManager.js\" type=\"text/JavaScript\" language=\"javascript\" ></script>";
?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
<div id="form">
<form id="form1" name="form1" method="post" action="<?php echo $insertTables->GetFormAction(); ?>">
<p>
<label for="name">Name</label>
<input type="text" name="name" id="name" />
</p>
<p>
<label for="sku">SKU</label>
<input type="text" name="sku" id="sku" />
</p>
<p>
<label for="price">Price</label>
<input type="text" name="price" id="price" />
</p>
<p>
<input onclick="<?php
//************************
//* INSERT 2 TABLES
//* Add region HTML code
//************************
$container = "container";
$content = "content";
$buttonName = "AddItem";
$tableFieldList = "option,option-price";
$deleteField = "";
$keyField = "";
echo "javascript:dwzAddRegion('" .$container ."','" .$content ."','" .$tableFieldList ."','" .$deleteField ."','" .$keyField ."')";
?>" type="button" name="AddItem" id="AddItem" value="Add Item" />
</p>
<div id="container">
<?php
//*********************************
//* INSERT 2 TABLES
//* Repeat region - start code
//*********************************
for($dwzTwoTablesCounter=1; $dwzTwoTablesCounter<=2; $dwzTwoTablesCounter++){
?>
<div id="content">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td><input onclick="<?php
//*********************************
//* INSERT 2 TABLES
//* Enable/Disable button
//*********************************
$buttonName = "enable";
$statusField = "";
$tableFieldList = "option,option-price";
echo "javascript:dwzEnableItem(" .$dwzTwoTablesCounter .",'" .$statusField ."','" .$tableFieldList ."')";
?>" type="button" name="enable" id="enable" value="Enable" />
<input onclick="<?php
//*********************************
//* INSERT 2 TABLES
//* Enable/Disable button
//*********************************
$buttonName = "disable";
$statusField = "Disabled";
$tableFieldList = "option,option-price";
echo "javascript:dwzEnableItem(" .$dwzTwoTablesCounter .",'" .$statusField ."','" .$tableFieldList ."')";
?>" type="button" name="disable" id="disable" value="Disable" /></td>
</tr>
<tr>
<td>Option</td>
<td>Price</td>
</tr>
<tr>
<td><input type="text" name="option[]" id="option[]" /></td>
<td><input type="text" name="option-price[]" id="option-price[]" /></td>
</tr>
</table>
</div>
<?php
//*********************************
//* INSERT 2 TABLES
//* Repeat region - end code
//*********************************
}
?>
</div>

<p>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</p>
<input type="hidden" name="dwzInsertTables" id="dwzInsertTables" value="form1" />
</form>
</div>
</body>
</html>
 
Reply to this current thread  View this persons public profile  Send Private Message
   Re: Two Tables Manager not adding multiple detail entries  
View this persons public profile  Gianluigi   23:44 31 Jan 2017  
   Re: Two Tables Manager not adding multiple detail entries  
View this persons public profile  KataMitchell   12:48 1 Feb 2017  
Last Visit: Thursday 23 Sep, 2021 6:58 pm First |  Prev |  Next |  Last  
 Login
Username:  Password:    
Read Message Read Message   Unread message Unread message
Read message [popular] Read message [popular]   Unread message [popular] Unread message [popular]
Read message [locked] Read message [locked]   Unread message [locked] Unread message [locked]
All times are GMT-2

Jump to: