Advertisement

08.06.2008 at 10:40AM PDT, ID: 23626572
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

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

Asked by hiamoduril in Macromedia Dreamweaver, PHP Scripting Language, MySQL Server

Tags: ,

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


Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
<?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);
?>
[+][-]08.06.2008 at 08:15PM PDT, ID: 22177104

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Macromedia Dreamweaver, PHP Scripting Language, MySQL Server
Tags: sql,php, 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.
Sign Up Now!
Solution Provided By: jason1178
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628