Link to home
Start Free TrialLog in
Avatar of hiamoduril
hiamoduril

asked on

How do I use Dreamweaver's Developer Toolbox to create custom forms?

I recently installed Dreamweaver's Developer Toolbox.  I'm trying to use the toolbox to create a custom form to update and query my mysql database.  I'm able to get the Toolbox to generate the php code and upload the file, but I receive the followng error message when I attempt to submit updates.  I'm a total beginner at this!  My goal is to be able to use the toolbox to create forms that allow users to both search the database and add or revise records within the database.  I've also attached the php code generated by the toolbox.  I have full permissions on the server.  

Error:
SQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1.
Developer Details:
SQL error: 1. (SQL_ERROR)
tNG Execution Trace - VIEW
tNG_custom.executeTransaction
STARTER.Trigger_Default_Starter
tNG_custom.doTransaction
BEFORE.Trigger_Default_FormValidation
tNG_custom.prepareSQL
tNG_custom.executeTransaction - execute sql*
tNG_custom.getRecordset
tNG_custom.getFakeRsArr
tNG_custom.getLocalRecordset
tNG_custom.getFakeRecordset
tNG_custom.getFakeRecordset



<?php require_once('Connections/roohoo.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_roohoo = new KT_connection($roohoo, $database_roohoo);
 
// Start trigger
$formValidation = new tNG_FormValidation();
$tNGs->prepareValidation($formValidation);
// End trigger
 
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
mysql_select_db($database_roohoo, $roohoo);
$query_Recordset1 = "SELECT * FROM Customers";
$Recordset1 = mysql_query($query_Recordset1, $roohoo) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
 
// Make a custom transaction instance
$customTransaction = new tNG_custom($conn_roohoo);
$tNGs->addTransaction($customTransaction);
// Register triggers
$customTransaction->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Custom1");
$customTransaction->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$customTransaction->registerTrigger("END", "Trigger_Default_Redirect", 99, "searchform.php");
// Set custom transaction SQL
$customTransaction->setSQL("{Recordset1.ID}");
// Add columns
$customTransaction->addColumn("qw", "STRING_TYPE", "POST", "qw");
$customTransaction->addColumn("re", "STRING_TYPE", "POST", "re");
$customTransaction->addColumn("tt", "STRING_TYPE", "POST", "tt");
// End of custom transaction instance
 
// Execute all the registered transactions
$tNGs->executeTransactions();
 
// Get the transaction recordset
$rscustom = $tNGs->getRecordset("custom");
$row_rscustom = mysql_fetch_assoc($rscustom);
$totalRows_rscustom = mysql_num_rows($rscustom);
?><!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>Untitled Document</title>
<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>
 
<?php
	echo $tNGs->getErrorMsg();
?>
<form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>">
  <table cellpadding="2" cellspacing="0" class="KT_tngtable">
    <tr>
      <td class="KT_th"><label for="qw">Qw:</label></td>
      <td><select name="qw" id="qw">
        <?php 
do {  
?>
        <option value="<?php echo $row_Recordset1['ID']?>"<?php if (!(strcmp($row_Recordset1['ID'], $row_rscustom['qw']))) {echo "SELECTED";} ?>><?php echo $row_Recordset1['ID']?></option>
        <?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  $rows = mysql_num_rows($Recordset1);
  if($rows > 0) {
      mysql_data_seek($Recordset1, 0);
	  $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  }
?>
      </select>
          <?php echo $tNGs->displayFieldError("custom", "qw"); ?> </td>
    </tr>
    <tr>
      <td class="KT_th"><label for="re">Re:</label></td>
      <td><input type="text" name="re" id="re" value="<?php echo KT_escapeAttribute($row_rscustom['re']); ?>" size="32" />
          <?php echo $tNGs->displayFieldHint("re");?> <?php echo $tNGs->displayFieldError("custom", "re"); ?> </td>
    </tr>
    <tr>
      <td class="KT_th"><label for="tt">Tt:</label></td>
      <td><input type="text" name="tt" id="tt" value="<?php echo KT_escapeAttribute($row_rscustom['tt']); ?>" size="32" />
          <?php echo $tNGs->displayFieldHint("tt");?> <?php echo $tNGs->displayFieldError("custom", "tt"); ?> </td>
    </tr>
    <tr class="KT_buttons">
      <td colspan="2"><input type="submit" name="KT_Custom1" id="KT_Custom1" value="Insert record" />
      </td>
    </tr>
  </table>
</form>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial