[dba-Tech] PHP code error

Kathryn Bassett kathryn at bassett.net
Wed May 13 16:20:43 CDT 2009


What's wrong with this code that it updates the collection name but not the
description?

<?php require_once('../Connections/CSadmin.php'); ?>
<?php
// Load the common classes
require_once('../includes/common/KT_common.php');

// Load the tNG classes
require_once('../includes/tng/tNG.inc.php');

// Make a transaction dispatcher instance
$tNGs = new tNG_dispatcher("../");

// Make unified connection variable
$conn_CSadmin = new KT_connection($CSadmin, $database_CSadmin);

// Start trigger
$formValidation = new tNG_FormValidation();
$formValidation->addField("tblCScollectionName", true, "text", "", "1", "",
"");
$tNGs->prepareValidation($formValidation);
// End trigger
// Start trigger
$formValidation1 = new tNG_FormValidation();
$formValidation1->addField("tblCScollectionName", true, "text", "", "1", "",
"");
$tNGs->prepareValidation($formValidation1);
// End trigger
// Make an insert transaction instance
$ins_tblCScollections = new tNG_insert($conn_CSadmin);
$tNGs->addTransaction($ins_tblCScollections);
// Register triggers
$ins_tblCScollections->registerTrigger("STARTER", "Trigger_Default_Starter",
1, "POST", "KT_Insert1");
$ins_tblCScollections->registerTrigger("BEFORE",
"Trigger_Default_FormValidation", 10, $formValidation);
$ins_tblCScollections->registerTrigger("END", "Trigger_Default_Redirect",
99, "admin/cs_admin.php");
// Add columns
$ins_tblCScollections->setTable("tblCScollections");
$ins_tblCScollections->addColumn("tblCScollectionName", "STRING_TYPE",
"POST", "tblCScollectionName");
$ins_tblCScollections->addColumn("tblCScollectionDescription",
"STRING_TYPE", "POST", "tblCScollectionDescription");
$ins_tblCScollections->setPrimaryKey("tblCScollectionID", "NUMERIC_TYPE");
// Make an insert transaction instance
$ins_tblCScollections1 = new tNG_insert($conn_CSadmin);
$tNGs->addTransaction($ins_tblCScollections1);
// Register triggers
$ins_tblCScollections1->registerTrigger("STARTER",
"Trigger_Default_Starter", 1, "POST", "KT_Insert2");
$ins_tblCScollections1->registerTrigger("BEFORE",
"Trigger_Default_FormValidation", 10, $formValidation1);
$ins_tblCScollections1->registerTrigger("END", "Trigger_Default_Redirect",
99, "cs_insertcollections.php");
// Add columns
$ins_tblCScollections1->setTable("tblCScollections");
$ins_tblCScollections1->addColumn("tblCScollectionName", "STRING_TYPE",
"POST", "tblCScollectionName");
$ins_tblCScollections1->setPrimaryKey("tblCScollectionID", "NUMERIC_TYPE");
// Execute all the registered transactions
$tNGs->executeTransactions();
// Get the transaction recordset
$rstblCScollections = $tNGs->getRecordset("tblCScollections");
$row_rstblCScollections = mysql_fetch_assoc($rstblCScollections);
$totalRows_rstblCScollections = mysql_num_rows($rstblCScollections);
?><!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add Collections into the Collections Table</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
-->
</style>
<link href="../includes/skins/mxkollection3.css" rel="stylesheet"
type="text/css" media="all" />
<script src="../includes/common/js/base.js" type="text/javascript"></script>
<script src="../includes/common/js/utility.js"
type="text/javascript"></script>
<script src="../includes/skins/style.js" type="text/javascript"></script>
<?php echo $tNGs->displayValidationRules();?>
</head>

<body>
<span class="style1">Add Collections into the Collections Table</span>
<?php
	echo $tNGs->getErrorMsg();
?>
<form method="post" id="form2" action="<?php echo
KT_escapeAttribute(KT_getFullUri()); ?>">
  <table cellpadding="2" cellspacing="0" class="KT_tngtable">
    <tr>
      <td class="KT_th"><label for="tblCScollectionDescription">Collection
Name:</label></td>
      <td><textarea name="tblCScollectionName" cols="50"
id="tblCScollectionName"><?php echo
KT_escapeAttribute($row_rstblCScollection['tblCScollectionName']);
?></textarea>
           <?php echo $tNGs->displayFieldHint("tblCStblCScollectionName");?>
<?php echo $tNGs->displayFieldError("tblCScollections",
"tblCScollectionName"); ?> </td>
     </tr>
     <tr>
       <td class="KT_th"><label for="tblCScollectionDescription">Collection
Description:</label></td>
       <td><textarea name="tblCScollectionDescription" cols="50"
id="tblCScollectionDescription"><?php echo
KT_escapeAttribute($row_rstblCScollection['tblCScollectionDescription']);
?></textarea>
       <?php echo $tNGs->displayFieldHint("tblCStblCScollectionName");?>
<?php echo $tNGs->displayFieldError("tblCScollections",
"tblCScollectionName"); ?> </td>
    </tr>
    <tr class="KT_buttons">
      <td colspan="2"><input type="submit" name="KT_Insert2" id="KT_Insert2"
value="Insert record" />      </td>
    </tr>
  </table>
</form>

<p><span class="style1">When finished adding Collections, <a
href="/admin/cs_admin.php">go back to Admin page</a></span></p>
</body>
</html>


Hopefully,

--
Kathryn Rhinehart Bassett (Pasadena CA)
"Genealogy is my bag" "GH is my soap"
kathryn at bassett.net
http://bassett.net   




More information about the dba-Tech mailing list