User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ColdFusion section within the Web Development category of DaniWeb, a massive community of 373,932 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,228 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ColdFusion advertiser:
Views: 1128 | Replies: 6 | Solved
Reply
Join Date: Feb 2008
Posts: 16
Reputation: zoid777 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
zoid777 zoid777 is offline Offline
Newbie Poster

Question <cfquery> Error

  #1  
Feb 5th, 2008
Hello Friends I ran into a syntax error updating a form, I have added a comment to the line below, Please could anyone tell me what I did wrong!!!!

<cfquery name="update student" datasource="#Request.super#">
UPDATE student
SET
studentfirstname='#Trim(Form.studentfirstname)#',.
studentlastname='#Trim(Form.studentlastname)#',.
address='#Trim(Form.address)#',.
city='#Trim(Form.city)#',.
state='#Trim(Form.state)#',.
studentage='#Trim(Form.studentage)#',.
studentclass='#Trim(Form.studentclass)#',.
studentstartdate='#Trim(Form.studentstartdate)#',.
studentgraduationdate='#Trim(Form.studentgraduationdate)#',.
comments=
<cfif Len(Trim(Form.comments)) GT 0>
'#Trim(Form.comments)#'
<cfelse>
NULL
</cfif>
WHERE
studentlastname = #Trim(Form.oldstudent)#,(THIS IS WHERE THE ERROR IS)
</cfquery>
<cflocation url="Finished.cfm?msg=#URLEncodedFormat('#Form.studentlastname# has been updated in the database.')#">
<html>
<head>
<title>studenteditaction page</title>
</head>

<body>
</body>
</html>
Last edited by peter_budo : Feb 6th, 2008 at 1:02 pm. Reason: Please use [code] tags for posting your coding examples
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2008
Posts: 1
Reputation: mbogdanovich is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
mbogdanovich mbogdanovich is offline Offline
Newbie Poster

Re: <cfquery> Error

  #2  
Feb 6th, 2008
Hello Zoid,

You might try single qoutes in around your variable. Hopefully that will do it.

Matt
Reply With Quote  
Join Date: Feb 2008
Posts: 16
Reputation: zoid777 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
zoid777 zoid777 is offline Offline
Newbie Poster

Question Re: <cfquery> Error

  #3  
Feb 6th, 2008
Originally Posted by mbogdanovich View Post
Hello Zoid,

You might try single qoutes in around your variable. Hopefully that will do it.

Matt


Hi Matt, thanks for the post. I tried single quotes but it still gave the same error
Reply With Quote  
Join Date: Feb 2008
Posts: 16
Reputation: zoid777 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
zoid777 zoid777 is offline Offline
Newbie Poster

Help Re: <cfquery> Error

  #4  
Feb 11th, 2008
Still need help!!!!
I am using a single table with Mysql 5.0.45 and it says check syntax error.
is this a bug or I am using the wrong syntax.
Reply With Quote  
Join Date: Feb 2008
Posts: 16
Reputation: zoid777 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
zoid777 zoid777 is offline Offline
Newbie Poster

Solution Re: <cfquery> Error

  #5  
Feb 11th, 2008
I found the solution it was the dots behind my declaration.
Reply With Quote  
Join Date: Nov 2007
Posts: 51
Reputation: Nige Ridd is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 9
Nige Ridd Nige Ridd is offline Offline
Junior Poster in Training

Re: <cfquery> Error

  #6  
Feb 11th, 2008
Erm can I make a suggestion that you look at using cfqueryparam as well, if anyone ever put a ' in any of the fields on the screen they can then do some nasty SQL injection into your code.
Nige
( See many references on the web about SQL Injection inculding http://msdn.microsoft.com/msdnmag/is.../SQLInjection/ )
Reply With Quote  
Join Date: Feb 2008
Posts: 16
Reputation: zoid777 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
zoid777 zoid777 is offline Offline
Newbie Poster

Re: <cfquery> Error

  #7  
Feb 28th, 2008
Nige thanks for your help, you where very helpful.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ColdFusion Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ColdFusion Forum

All times are GMT -4. The time now is 6:13 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC