473,670 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

coldfusion mysql error

23 New Member
Anyone see what I'm doing wrong?
Here's the form field:
Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="date" value="<cfoutput>#DateFormat(Now(), "MM/DD/YY")# At #TimeFormat(Now(),"hh:mm tt")#</cfoutput>" size="32">
  2.  
Here's the sql insert:
Expand|Select|Wrap|Line Numbers
  1.   <cfif IsDefined("FORM.date") AND #FORM.date# NEQ "">
  2.     '#FORM.date#'
  3.       <cfelse>
  4.     NULL
  5.   </cfif>
  6.  
,

(NOTE: I've tried with and without the single quotes around #FORM.date#

Here's the error.

Expand|Select|Wrap|Line Numbers
  1. 14 : <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
  2. 15 :   
  3. 16 :   <cfquery datasource="">
  4. 17 :     INSERT INTO scoretable (puzzleid, studentid, pointpossible, score, time, date, percentage)
  5. 18 :     VALUES (
  6.  
  7.  
--------------------------------------------------------------------------------

Expand|Select|Wrap|Line Numbers
  1. SQL    INSERT INTO scoretable (puzzleid, studentid, pointpossible, score, time, date, percentage) VALUES ( NULL , 111 , 9 , 9 , 23 , '12/16/06 At 12:47 AM' , 100% )  
  2. DATASOURCE    
  3. VENDORERRORCODE   1064 
  4. SQLSTATE   42000
Dec 16 '06 #1
3 6790
bishwadeep
12 New Member
Try the following code:
I think you have error while inserting the date
do you have separate field for date and time?

Expand|Select|Wrap|Line Numbers
  1. <form action="" method="post">
  2. <input type="hidden" name="date" value="<cfoutput>#DateFormat(Now(), "MM/DD/YY")#</cfoutput>">
  3. <input type="hidden" name="time" value="<cfoutput>#TimeFormat(Now(),"hh:mm tt")#</cfoutput>">
  4. </form>
  5. <cfif IsDefined("FORM.date") AND #FORM.date# NEQ "">
  6. '#FORM.date#'
  7. <cfelse>
  8. NULL
  9. </cfif>
  10.  
  11. <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
  12. <cfquery datasource="">
  13. INSERT INTO scoretable (puzzleid, studentid, pointpossible, score, time, date, percentage)
  14. VALUES (NULL , 111 , 9 , 9 , 23 ,'#form.time#','#form.date#',100% )
  15. </cfquery>
  16. </cfif>
Dec 25 '06 #2
acoder
16,027 Recognized Expert Moderator MVP
Anyone see what I'm doing wrong?
Here's the form field:
<input type="hidden" name="date" value="<cfoutpu t>#DateFormat(N ow(), "MM/DD/YY")# At #TimeFormat(Now (),"hh:mm tt")#</cfoutput>" size="32">

Here's the sql insert:
<cfif IsDefined("FORM .date") AND #FORM.date# NEQ "">
'#FORM.date#'
<cfelse>
NULL
</cfif>
,

(NOTE: I've tried with and without the single quotes around #FORM.date#

Here's the error.

14 : <cfif IsDefined("FORM .MM_InsertRecor d") AND FORM.MM_InsertR ecord EQ "form1">
15 :
16 : <cfquery datasource="">
17 : INSERT INTO scoretable (puzzleid, studentid, pointpossible, score, time, date, percentage)
18 : VALUES (



--------------------------------------------------------------------------------

SQL INSERT INTO scoretable (puzzleid, studentid, pointpossible, score, time, date, percentage) VALUES ( NULL , 111 , 9 , 9 , 23 , '12/16/06 At 12:47 AM' , 100% )
DATASOURCE
VENDORERRORCODE 1064
SQLSTATE 42000
A number of points:

1. Why are you passing the date as a hidden field if you're using today's date anyway. Just use the code on the page that contains the query.
2. Date should be in the recognised format for the mysql database. I doubt that the format you are using is correct. Search for acceptable date formats. Remove the 'At' - surely that is not needed.
3. In you query, you have Null for puzzleid which is definitely incorrect - you can't have a null value for a primary key.
4. For time, you have a value of 23. what does that mean?
5. As I explained, the date is of the wrong format.
6. The percentage sign % holds special significance in SQL. Just use 100 instead.
7. Perhaps, you could consider changing your database, e.g. no need to store percentage because it can easily be calculated. also, the puzzle table will contain the pointpossible value which you can easily obtain so no need to store that in the scoretable either.
8. Date/time should be one field.

Quite a few things there for you to think over..
Dec 26 '06 #3
RedSon
5,000 Recognized Expert Expert
Next time, please remember that this is a website so posting sensitive information about your company or posting code/text that can be easily googled by your company managers is probably not a good idea.
Jan 11 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

60
10060
by: English Teacher | last post by:
Which would be more useful to learn, PHP or COLDFUSION? I know Coldfusion is popular in the work force. Is PHP? Thanks!
1
5135
by: asnyder131 | last post by:
I'm a newby here as well as to mysql and coldfusion. I'm a business owner who had previously designed my own relational database system for my company (smartware) and used it sucessfully for many years. I have recently paid for a new web based system and decided to go with a programmer that built a coldfusion mx/mysql system. There are a number of features and procedures that are not working correctly and my programmer is telling me that...
3
23065
acoder
by: acoder | last post by:
How to Upload a File in Coldfusion Use the cffile tag for uploading files to the server. Note that allowing people to upload files is fraught with danger and only trusted users should be allowed to upload files. Checks should be made to make sure that only allowed file types are uploaded. The Client-Side First of all, let us deal with the client side. This assumes some knowledge of HTML.
7
8223
acoder
by: acoder | last post by:
This page will link to a number of tutorials. Coldfusion Language Coldfusion Variables Using Coldfusion Variables Coldfusion Image Gallery How to upload a file in Coldfusion How to send mail using Coldfusion Coldfusion Tips and Tricks
3
7250
by: jesmi | last post by:
how to connect coldfusion and access? while connecting like mysql gave following error: This applet displays a file-tree of the server to enable the user to browse its contents. Your browser is not configured correctly to use java applets. Please install the Java Runtime Environment (JRE) and be sure to install the browser plugins.
3
5414
by: sj3vans | last post by:
I'm trying to integrate a ColdFusion application with a webAPI provided by another company to access their services. Their requirements are that requests should be generated using standard HTTP Posts with the following HTTP Headers: Content-Type: text/XML Content-Length: {Length of content} The sample code they sent on how to access the API are .bat files that call their API via JAVA. Here is one of the .bat files: @echo off call...
1
4279
by: marcnz | last post by:
I have been charged of creating a coldfusion web site for our company. Our database has a ms sql 2005 backend and ms access frontend. Almost all tables are linked tables with the SQL database, except the temp tables needed at runtime that are in the ms access database. It will be easier for us to utilize the ms access queries and temp tables, so I set up a datasource on our web server and within the coldfusion administrator to point to the ms...
2
4074
by: quest007 | last post by:
Hi! I have configured IIS for coldfusion and when I access my coldfusion site through localhost, the pages are served as required. But if i ty to access it from a remote machine by specifying the IP address in the url, it displays an error: The web site you are accessing has experienced an unexpected error. File not found: /mysite/htdocs/dsp_welcome.cfm While searching for the error, I found a solution which suggests that it might be...
2
3629
by: joshMcwatters | last post by:
Hi, I'm trying us mySql user defined variables in a cfquery tag, but I keep getting an error. I know the statement should work because I've tested it a mySQL GUI without problems. Coldfusion is taking issue with the SET @var=0; part of my statement. Here is the statement in full; SET @pos=0;
7
1700
by: SAL | last post by:
Hopefully someone will have a clue as to what is happening here. In our office, we have both ColdFusion and ASP.NET applications. One of our new developers has been installing ColdFusion 8 on the servers and after the install, a couple of my apps have been unreachable. IIS would report the NOT Found error. The folders would still be there and it would still look like it was an application viewing it in IIS. You just couldn't reach the app...
0
8386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7419
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5684
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4391
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2800
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2042
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.