问题
I have a query that needs to update What_name with whatever I type in the form. This is a snippet of my code:
<cfelseif ARGUMENTS.myForm.Submit EQ "Update_what">
<cfquery name="LOCAL.myURL" datasource="#SERVER.cfc.core.getDSN()#">
SELECT What_name
from logboek.tbl_What
WHERE What_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.myForm.What_name#" />
</cfquery>
<cfif LOCAL.myURL.RecordCount eq 1>
<cfreturn VARIABLES.Error.myReturn />
<cfelse>
<cfquery name="LOCAL.myURL" datasource="#SERVER.cfc.core.getDSN()#">
UPDATE tbl_What
SET What_name=<cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.myForm.Update_what#" />;
WHERE What_name=<cfqueryparam value="#ARGUMENTS.myForm.What_name#" cfsqltype="cf_sql_varchar">
</cfquery>
</cfif>
I am getting the following error:
Message
string Component [cms_core.com.blog.blog] has no accessible Member with name [ERROR]
Is there something wrong with my query?
来源:https://stackoverflow.com/questions/34874720/sql-coldfusion-get-id-from-database-and-than-update-a-row-with-form-field-value