ClarkKent101
Programmer
Hi Everyone,
I have a form which i use to update a MySQL database. The form contains three radio buttons which i have included, these three radio buttons need to assign one value to each of their corresponding fields in the MySQL database... in other words, each radio button is tied together to one a field in the database.
The problem i am experiencing is this error i keep getting when i submit the form, the error states the following:
"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=11' at line 147"
I checked the SQL and it looks fine to me, but just in case i'm doing something wrong (which i must be) i'll post the code that the error points to. Here are the lines of code the error displays to me...
246 : carOffline = 1
247 : </cfif>
248 : WHERE carModelID=#FORM.carModelID#
249 : </cfquery>
250 : <cflocation url="/admin/cars/index.cfm">
Line number 248 should be in Bold, that is what coldfusion is pointing out to me to be wrong. I had this working before with checkboxes but checkboxes don't serve the same purpose radio buttons do... Here is the code i implemented to assign the value of each radio button to their corresponding field in the database...(Note: The following code is the lines of code before line number 246)
, <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 i will post the radio button input tags that correspond to the above 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>>
Can anybody see what i am doing wrong? I can't seem to find any syntax error but yet coldfusion keeps throwing me with that error everytime i submit the form. Any ideas?
Thank you for your time,
- CK
I have a form which i use to update a MySQL database. The form contains three radio buttons which i have included, these three radio buttons need to assign one value to each of their corresponding fields in the MySQL database... in other words, each radio button is tied together to one a field in the database.
The problem i am experiencing is this error i keep getting when i submit the form, the error states the following:
"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=11' at line 147"
I checked the SQL and it looks fine to me, but just in case i'm doing something wrong (which i must be) i'll post the code that the error points to. Here are the lines of code the error displays to me...
246 : carOffline = 1
247 : </cfif>
248 : WHERE carModelID=#FORM.carModelID#
249 : </cfquery>
250 : <cflocation url="/admin/cars/index.cfm">
Line number 248 should be in Bold, that is what coldfusion is pointing out to me to be wrong. I had this working before with checkboxes but checkboxes don't serve the same purpose radio buttons do... Here is the code i implemented to assign the value of each radio button to their corresponding field in the database...(Note: The following code is the lines of code before line number 246)
, <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 i will post the radio button input tags that correspond to the above 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>>
Can anybody see what i am doing wrong? I can't seem to find any syntax error but yet coldfusion keeps throwing me with that error everytime i submit the form. Any ideas?
Thank you for your time,
- CK