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("parents@_@msql_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> |
|
|