?
Solved

Error creating temporary table: Developer Toolbox, Dreamweaver CS3

Posted on 2008-06-18
7
Medium Priority
?
1,203 Views
Last Modified: 2010-04-21
I am using the Developer Toolbox "Insert Record Form Wizard", which I have used many times in the past with 0 problems. I set up an sql table on my server as usual, and have checked it and checked it again for proper formatting. I think it is fine. The code also looks fine to me. I've checked it against the code for similar forms and it looks structurally identical. I'm at my wits end.
<?php require_once('../Connections/Assessment.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_Assessment = new KT_connection($Assessment, $database_Assessment);
 
// calculate total
$mind_sum = 0;
$mind_sum += $_POST['emochange'];
$mind_sum += $_POST['emocause'];
$mind_sum += $_POST['noticenature'];
$mind_sum += $_POST['notcaughtup'];
$mind_sum += $_POST['thankful'];
$mind_sum += $_POST['flow'];
$mind_sum += $_POST['everydayjoy'];
$mind_sum += $_POST['listenpeople'];
$mind_sum += $_POST['examinelife'];
$mind_sum += $_POST['moreinsight'];
$mind_sum += $_POST['morecontrol'];
$mind_sum += $_POST['morepositive'];
$mind_sum += $_POST['newhappiness'];
$mind_sum += $_POST['touch'];
$mind_sum += $_POST['payattention'];
$mind_sum += $_POST['newway'];
$mind_sum += $_POST['peaceful'];
$mind_sum += $_POST['smell'];
$mind_sum += $_POST['objective'];
$mind_sum += $_POST['sensation'];
$mind_sum += $_POST['attentive'];
$mind_sum += $_POST['firsttime'];
$mind_sum += $_POST['change'];
$mind_sum += $_POST['attention'];
$mind_sum += $_POST['participate'];
$mind_sum += $_POST['ordinary'];
$mind_sum += $_POST['wander'];
$mind_sum += $_POST['equanimity'];
$mind_sum += $_POST['newthings'];
$mind_sum += $_POST['angerhurt'];
$mind_sum += $_POST['compassion'];
$mind_sum += $_POST['sand'];
 
$_SESSION["mind_sum"] = $sum;
 
 
// Start trigger
$formValidation = new tNG_FormValidation();
$formValidation->addField("sex", true, "numeric", "", "", "", "");
$formValidation->addField("age", true, "numeric", "", "", "", "");
$formValidation->addField("edu", true, "numeric", "", "", "", "");
$formValidation->addField("ethnicity", true, "numeric", "", "", "", "");
$formValidation->addField("english", true, "numeric", "", "", "", "");
$formValidation->addField("emochange", true, "numeric", "", "", "", "");
$formValidation->addField("emocause", true, "numeric", "", "", "", "");
$formValidation->addField("noticenature", true, "numeric", "", "", "", "");
$formValidation->addField("notcaughtup", true, "numeric", "", "", "", "");
$formValidation->addField("thankful", true, "numeric", "", "", "", "");
$formValidation->addField("flow", true, "numeric", "", "", "", "");
$formValidation->addField("everydayjoy", true, "numeric", "", "", "", "");
$formValidation->addField("lessstress", true, "numeric", "", "", "", "");
$formValidation->addField("listenpeople", true, "numeric", "", "", "", "");
$formValidation->addField("examinelife", true, "numeric", "", "", "", "");
$formValidation->addField("moreinsight", true, "numeric", "", "", "", "");
$formValidation->addField("morecontrol", true, "numeric", "", "", "", "");
$formValidation->addField("morepositive", true, "numeric", "", "", "", "");
$formValidation->addField("newhappiness", true, "numeric", "", "", "", "");
$formValidation->addField("touch", true, "numeric", "", "", "", "");
$formValidation->addField("payattention", true, "numeric", "", "", "", "");
$formValidation->addField("newway", true, "numeric", "", "", "", "");
$formValidation->addField("peaceful", true, "numeric", "", "", "", "");
$formValidation->addField("smell", true, "numeric", "", "", "", "");
$formValidation->addField("objective", true, "numeric", "", "", "", "");
$formValidation->addField("sensation", true, "numeric", "", "", "", "");
$formValidation->addField("attentive", true, "numeric", "", "", "", "");
$formValidation->addField("firsttime", true, "numeric", "", "", "", "");
$formValidation->addField("change", true, "numeric", "", "", "", "");
$formValidation->addField("attention", true, "numeric", "", "", "", "");
$formValidation->addField("participate", true, "numeric", "", "", "", "");
$formValidation->addField("ordinary", true, "numeric", "", "", "", "");
$formValidation->addField("wander", true, "numeric", "", "", "", "");
$formValidation->addField("equanimity", true, "numeric", "", "", "", "");
$formValidation->addField("newthings", true, "numeric", "", "", "", "");
$formValidation->addField("angerhurt", true, "numeric", "", "", "", "");
$formValidation->addField("compassion", true, "numeric", "", "", "", "");
$formValidation->addField("sand", true, "numeric", "", "", "", "");
$formValidation->addField("userno", true, "numeric", "", "", "", "");
$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_Assessment, $Assessment);
$query_rsSex = "SELECT * FROM Sex";
$rsSex = mysql_query($query_rsSex, $Assessment) or die(mysql_error());
$row_rsSex = mysql_fetch_assoc($rsSex);
$totalRows_rsSex = mysql_num_rows($rsSex);
 
mysql_select_db($database_Assessment, $Assessment);
$query_rsEdu = "SELECT * FROM EduAttainment";
$rsEdu = mysql_query($query_rsEdu, $Assessment) or die(mysql_error());
$row_rsEdu = mysql_fetch_assoc($rsEdu);
$totalRows_rsEdu = mysql_num_rows($rsEdu);
 
mysql_select_db($database_Assessment, $Assessment);
$query_rsEthnicity = "SELECT * FROM Ethnicity";
$rsEthnicity = mysql_query($query_rsEthnicity, $Assessment) or die(mysql_error());
$row_rsEthnicity = mysql_fetch_assoc($rsEthnicity);
$totalRows_rsEthnicity = mysql_num_rows($rsEthnicity);
 
mysql_select_db($database_Assessment, $Assessment);
$query_rsEnglish = "SELECT * FROM EnglishQuality";
$rsEnglish = mysql_query($query_rsEnglish, $Assessment) or die(mysql_error());
$row_rsEnglish = mysql_fetch_assoc($rsEnglish);
$totalRows_rsEnglish = mysql_num_rows($rsEnglish);
 
mysql_select_db($database_Assessment, $Assessment);
$query_rsRating = "SELECT Ratings4.Rating, Ratings4.Ratings4key  FROM Ratings4";
$rsRating = mysql_query($query_rsRating, $Assessment) or die(mysql_error());
$row_rsRating = mysql_fetch_assoc($rsRating);
$totalRows_rsRating = mysql_num_rows($rsRating);
 
 
// Make an insert transaction instance
$ins_Mindfulness = new tNG_insert($conn_Assessment);
$tNGs->addTransaction($ins_Mindfulness);
// Register triggers
$ins_Mindfulness->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
$ins_Mindfulness->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$ins_Mindfulness->registerTrigger("END", "Trigger_Default_Redirect", 99, "m-results.php");
// Add columns
$ins_Mindfulness->setTable("Mindfulness");
$ins_Mindfulness->addColumn("sex", "NUMERIC_TYPE", "POST", "sex");
$ins_Mindfulness->addColumn("age", "NUMERIC_TYPE", "POST", "age");
$ins_Mindfulness->addColumn("edu", "NUMERIC_TYPE", "POST", "edu");
$ins_Mindfulness->addColumn("sum", "NUMERIC_TYPE", "VALUE", "{SESSION.sum}");
$ins_Mindfulness->addColumn("ethnicity", "NUMERIC_TYPE", "POST", "ethnicity");
$ins_Mindfulness->addColumn("english", "NUMERIC_TYPE", "POST", "english");
$ins_Mindfulness->addColumn("emochange", "NUMERIC_TYPE", "POST", "emochange");
$ins_Mindfulness->addColumn("emocause", "NUMERIC_TYPE", "POST", "emocause");
$ins_Mindfulness->addColumn("noticenature", "NUMERIC_TYPE", "POST", "noticenature");
$ins_Mindfulness->addColumn("notcaughtup", "NUMERIC_TYPE", "POST", "notcaughtup");
$ins_Mindfulness->addColumn("thankful", "NUMERIC_TYPE", "POST", "thankful");
$ins_Mindfulness->addColumn("flow", "NUMERIC_TYPE", "POST", "flow");
$ins_Mindfulness->addColumn("everydayjoy", "NUMERIC_TYPE", "POST", "everydayjoy");
$ins_Mindfulness->addColumn("lessstress", "NUMERIC_TYPE", "POST", "lessstress");
$ins_Mindfulness->addColumn("listenpeople", "NUMERIC_TYPE", "POST", "listenpeople");
$ins_Mindfulness->addColumn("examinelife", "NUMERIC_TYPE", "POST", "examinelife");
$ins_Mindfulness->addColumn("moreinsight", "NUMERIC_TYPE", "POST", "moreinsight");
$ins_Mindfulness->addColumn("morecontrol", "NUMERIC_TYPE", "POST", "morecontrol");
$ins_Mindfulness->addColumn("morepositive", "NUMERIC_TYPE", "POST", "morepositive");
$ins_Mindfulness->addColumn("newhappiness", "NUMERIC_TYPE", "POST", "newhappiness");
$ins_Mindfulness->addColumn("touch", "NUMERIC_TYPE", "POST", "touch");
$ins_Mindfulness->addColumn("payattention", "NUMERIC_TYPE", "POST", "payattention");
$ins_Mindfulness->addColumn("newway", "NUMERIC_TYPE", "POST", "newway");
$ins_Mindfulness->addColumn("peaceful", "NUMERIC_TYPE", "POST", "peaceful");
$ins_Mindfulness->addColumn("smell", "NUMERIC_TYPE", "POST", "smell");
$ins_Mindfulness->addColumn("objective", "NUMERIC_TYPE", "POST", "objective");
$ins_Mindfulness->addColumn("sensation", "NUMERIC_TYPE", "POST", "sensation");
$ins_Mindfulness->addColumn("attentive", "NUMERIC_TYPE", "POST", "attentive");
$ins_Mindfulness->addColumn("firsttime", "NUMERIC_TYPE", "POST", "firsttime");
$ins_Mindfulness->addColumn("change", "NUMERIC_TYPE", "POST", "change");
$ins_Mindfulness->addColumn("attention", "NUMERIC_TYPE", "POST", "attention");
$ins_Mindfulness->addColumn("participate", "NUMERIC_TYPE", "POST", "participate");
$ins_Mindfulness->addColumn("ordinary", "NUMERIC_TYPE", "POST", "ordinary");
$ins_Mindfulness->addColumn("wander", "NUMERIC_TYPE", "POST", "wander");
$ins_Mindfulness->addColumn("equanimity", "NUMERIC_TYPE", "POST", "equanimity");
$ins_Mindfulness->addColumn("newthings", "NUMERIC_TYPE", "POST", "newthings");
$ins_Mindfulness->addColumn("angerhurt", "NUMERIC_TYPE", "POST", "angerhurt");
$ins_Mindfulness->addColumn("compassion", "NUMERIC_TYPE", "POST", "compassion");
$ins_Mindfulness->addColumn("sand", "NUMERIC_TYPE", "POST", "sand");
$ins_Mindfulness->addColumn("userno", "NUMERIC_TYPE", "POST", "userno", "{SESSION.kt_login_id}");
$ins_Mindfulness->setPrimaryKey("mindfulkey", "NUMERIC_TYPE");
 
// Execute all the registered transactions
$tNGs->executeTransactions();
 
// Get the transaction recordset
$rsMindfulness = $tNGs->getRecordset("Mindfulness");
$row_rsMindfulness = mysql_fetch_assoc($rsMindfulness);
$totalRows_rsMindfulness = mysql_num_rows($rsMindfulness);
?>

Open in new window

0
Comment
Question by:theodawson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 21815261
>> Error creating temporary table

The MySQL user needs to have both Create and Drop privileges in order for the Toolkit to work.  When you get the above error, one of those privs is not there for the defined user.
0
 

Author Comment

by:theodawson
ID: 21815786
I have all privileges.
0
 

Author Comment

by:theodawson
ID: 21815812
Here is the rest of the error message.

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 'change TEXT, attention TEXT, participate TEXT, ordinary TEXT, wander TEXT, equan' at line 1
SQL:
CREATE TEMPORARY TABLE KT_fakeRS_20080618 (sex TEXT, age TEXT, edu TEXT, sum TEXT, ethnicity TEXT, english TEXT, emochange TEXT, emocause TEXT, noticenature TEXT, notcaughtup TEXT, thankful TEXT, flow TEXT, everydayjoy TEXT, lessstress TEXT, listenpeople TEXT, examinelife TEXT, moreinsight TEXT, morecontrol TEXT, morepositive TEXT, newhappiness TEXT, touch TEXT, payattention TEXT, newway TEXT, peaceful TEXT, smell TEXT, objective TEXT, sensation TEXT, attentive TEXT, firsttime TEXT, change TEXT, attention TEXT, participate TEXT, ordinary TEXT, wander TEXT, equanimity TEXT, newthings TEXT, angerhurt TEXT, compassion TEXT, sand TEXT, userno TEXT, mindfulkey TEXT) (FIELDS_FAKE_RS_ERROR)
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 1000 total points
ID: 21815835
"change TEXT"

"Change" might be a reserved MySQL word.  Try changing that field and/or database column to something else...
0
 

Author Comment

by:theodawson
ID: 21816040
jason1178 RULES! Many thanks!
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 21816172
You're welcome...
0
 

Author Closing Comment

by:theodawson
ID: 31468344
I spent about 7 hours troubleshooting this problem. I was VERY grateful for such a prompt solution.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question