[AccessD] PHP code error

Michael Bahr jedi at charm.net
Wed May 20 19:44:59 CDT 2009


Hi Kathryn, is there an actual error message or just not the expected results?  I would **guess** that tblCScollectionName is part of the form validation but tblCScollectionDescription is not.(?)  Try adding the field to your code like below.  This is only a guess.  

Also there is a $formValidation1 variable not used--either remove it or comment it out.

// Start trigger
$formValidation = new tNG_FormValidation();
$formValidation->addField("tblCScollectionName", true, "text", "", "1", "", ""); ==>$formValidation->addField("tblCScollectionDescription ", true, "text", "", "1", "", "");
$tNGs->prepareValidation($formValidation);
// End trigger

Note: this is hard to read.  I suggest using an editor the does not line-wrap (like Ultra-Edit) and try adding blank lines in between the "code groups with comments".  It makes for much easier reading and debugging.  Add copious amounts of space between php code and html code.

HTH, Mike...


> I've tried this on dba-tech, the off-topic list, and a web design
> list, all with no answer. Can anyone here take a crack at it?
> Kathryn
>
> 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
>
> _______________________________________________
> dba-Tech mailing list
> dba-Tech at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-tech
> Website: http://www.databaseadvisors.com




More information about the AccessD mailing list