Current location: Hot Scripts Forums » Programming Languages » Other Languages » SQL/Coldfusion radio button problem.....


SQL/Coldfusion radio button problem.....

Reply
  #1 (permalink)  
Old 07-19-06, 02:12 PM
Clark_Kent's Avatar
Clark_Kent Clark_Kent is offline
Newbie Coder
 
Join Date: Mar 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
SQL/Coldfusion radio button problem.....

Hey Everyone,

I have a form which contains three radio buttons and each one of those radio buttons has a value that needs to be assigned to three fields in a database. I'm using coldfusion and MySQL. So far my radio buttons act like they should, only problem is when i submit the form (which will update the database), coldfusion gives me an error which states the following:

Code:
"Syntax error or access violation message from server: "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 'WHERE carModelID=' at line 146"
Here is the lines of code the error points to...

Code:
245 : 			carOffline = 1
246 : 	  </cfif>
247 :   WHERE carModelID=#FORM.carModelID#</cfquery>
248 :   <cflocation url="/admin/cars/index.cfm">
249 : </cfif>
I have implemented a <cfif> selection structure to assign the appropriate value to its corresonding radio button, in the lines of code above it starts with line number 245, the following code is all the lines before that which i implemented...

Code:
    , <cfif FORM.radioGroup EQ 'online'>
    		online = 1,
		carDeleted = 0,
		carOffline = 0,
  		<cfelseif FORM.radioGroup EQ 'carDeleted'>
  		  online = 0,
		carDeleted = 1,
		carOffline = 0,
		<cfelseif FORM.radioGroup EQ 'carOffline'>
    		online = 0,
		carDeleted = 0,
		carOffline = 1
	  </cfif>
  WHERE carModelID=#FORM.carModelID#</cfquery>
And lastly, here are the input tags for the radio buttons...

Code:
<input type="radio" name="radioGroup" value="carDeleted" <cfif (#rsCarModel.carDeleted# EQ 1)>checked</cfif>>

<input type="radio" name="radioGroup" value="carOffline" <cfif (#rsCarModel.carOffline# EQ 1)>checked</cfif>>

<input type="radio" name="radioGroup" value="online" <cfif (#rsCarModel.online# EQ 1)>checked</cfif>>
The error states there is something wrong with line of code with the WHERE clause, i can't see anything wrong with it, i'm assuming something before it is whats causing the problem.... can anybody see whats wrong with any of the syntax?

Thanks for your help,

- CK
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-19-06, 05:43 PM
Clark_Kent's Avatar
Clark_Kent Clark_Kent is offline
Newbie Coder
 
Join Date: Mar 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
No worries, i found the problem.

Here lied the problem...

Code:
    , <cfif FORM.radioGroup EQ 'online'>
    		online = 1,
		carDeleted = 0,
		carOffline = 0,
  		<cfelseif FORM.radioGroup EQ 'carDeleted'>
  		  online = 0,
		carDeleted = 1,
		carOffline = 0,
		<cfelseif FORM.radioGroup EQ 'carOffline'>
    		online = 0,
		carDeleted = 0,
		carOffline = 1
	  </cfif>
  WHERE carModelID=#FORM.carModelID#</cfquery>
The commas in bold aren't supposed to be there.

I hope this helps someone ,

- CK
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form not updateding when I click radio button. Spreegem JavaScript 9 03-25-06 07:50 PM
How to replace radio button in a form with a picture? amazing PHP 2 11-17-05 09:17 AM
check if a radio button has been checked crmpicco JavaScript 1 10-17-05 04:17 PM
Problem with SWITCH function in Radio Button group maverickblair PHP 1 02-27-04 11:49 AM
radio button selection TheLaughingBandit ASP 3 08-31-03 07:22 PM


All times are GMT -5. The time now is 01:39 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.