Question
update link shows the first record only
I have done the update record many times. It has always
worked in the past. Not today!
I have an update link on my main page. When I click the link it only shows the first record, no matter which record I choose on the main page to update. I am sending the URL parameter. The add record and delete record behaviors work for any record. Just not the update.
I have tried to build the table and make it work as well as using the update record wizard with no luck. It seems stuck on the default=1 parameter in the page and I only get the default.
Here's the code the wizard generates:
<cfif MM_Username EQ "">
<cfset MM_referer=CGI.SCRIPT_NAME>
<cfif CGI.QUERY_STRING NEQ "">
<cfset MM_referer=MM_referer & "?" & CGI.QUERY_STRING>
</cfif>
<cfset MM_failureURL="login.cfm?accessdenied=" & URLEncodedFormat(MM_referer)>
<cflocation url="#MM_failureURL#" addtoken="no">
</cfif>
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
<cfquery datasource="dsncris">
INSERT INTO photos (name, link, "description", "year", category)
VALUES (<cfif IsDefined("FORM.name") AND #FORM.name# NEQ "">
<cfqueryparam value="#FORM.name#" cfsqltype="cf_sql_clob" maxlength="100">
<cfelse>
''
</cfif>
,
<cfif IsDefined("FORM.link") AND #FORM.link# NEQ "">
<cfqueryparam value="#FORM.link#" cfsqltype="cf_sql_clob" maxlength="150">
<cfelse>
''
</cfif>
,
<cfif IsDefined("FORM.description") AND #FORM.description# NEQ "">
<cfqueryparam value="#FORM.description#" cfsqltype="cf_sql_clob" maxlength="1073741823">
<cfelse>
''
</cfif>
,
<cfif IsDefined("FORM.year") AND #FORM.year# NEQ "">
<cfqueryparam value="#FORM.year#" cfsqltype="cf_sql_clob" maxlength="4">
<cfelse>
''
</cfif>
,
<cfif IsDefined("FORM.category") AND #FORM.category# NEQ "">
<cfqueryparam value="#FORM.category#" cfsqltype="cf_sql_clob" maxlength="1">
<cfelse>
''
</cfif>
)</cfquery>
<cflocation url="main.cfm?updateok=true">
</cfif>
<cfparam name="URL.ID" default="1">
<cfquery name="rsupd" datasource="dsncris">
SELECT *
FROM photos
WHERE ID =
<cfqueryparam value="#URL.ID#" cfsqltype="cf_sql_numeric">
</cfquery>
I have not seen this line: <cfparam name="URL.ID" default="1"> before in my other update pages that seem to work properly. I am using an Access ODBC database. Should I use the Access Unicode instead of Access for the ODBC connection?
Anyone else having this problem and how did you solve it?
Thanks in advance for any help.
I have an update link on my main page. When I click the link it only shows the first record, no matter which record I choose on the main page to update. I am sending the URL parameter. The add record and delete record behaviors work for any record. Just not the update.
I have tried to build the table and make it work as well as using the update record wizard with no luck. It seems stuck on the default=1 parameter in the page and I only get the default.
Here's the code the wizard generates:
<cfif MM_Username EQ "">
<cfset MM_referer=CGI.SCRIPT_NAME>
<cfif CGI.QUERY_STRING NEQ "">
<cfset MM_referer=MM_referer & "?" & CGI.QUERY_STRING>
</cfif>
<cfset MM_failureURL="login.cfm?accessdenied=" & URLEncodedFormat(MM_referer)>
<cflocation url="#MM_failureURL#" addtoken="no">
</cfif>
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
<cfquery datasource="dsncris">
INSERT INTO photos (name, link, "description", "year", category)
VALUES (<cfif IsDefined("FORM.name") AND #FORM.name# NEQ "">
<cfqueryparam value="#FORM.name#" cfsqltype="cf_sql_clob" maxlength="100">
<cfelse>
''
</cfif>
,
<cfif IsDefined("FORM.link") AND #FORM.link# NEQ "">
<cfqueryparam value="#FORM.link#" cfsqltype="cf_sql_clob" maxlength="150">
<cfelse>
''
</cfif>
,
<cfif IsDefined("FORM.description") AND #FORM.description# NEQ "">
<cfqueryparam value="#FORM.description#" cfsqltype="cf_sql_clob" maxlength="1073741823">
<cfelse>
''
</cfif>
,
<cfif IsDefined("FORM.year") AND #FORM.year# NEQ "">
<cfqueryparam value="#FORM.year#" cfsqltype="cf_sql_clob" maxlength="4">
<cfelse>
''
</cfif>
,
<cfif IsDefined("FORM.category") AND #FORM.category# NEQ "">
<cfqueryparam value="#FORM.category#" cfsqltype="cf_sql_clob" maxlength="1">
<cfelse>
''
</cfif>
)</cfquery>
<cflocation url="main.cfm?updateok=true">
</cfif>
<cfparam name="URL.ID" default="1">
<cfquery name="rsupd" datasource="dsncris">
SELECT *
FROM photos
WHERE ID =
<cfqueryparam value="#URL.ID#" cfsqltype="cf_sql_numeric">
</cfquery>
I have not seen this line: <cfparam name="URL.ID" default="1"> before in my other update pages that seem to work properly. I am using an Access ODBC database. Should I use the Access Unicode instead of Access for the ODBC connection?
Anyone else having this problem and how did you solve it?
Thanks in advance for any help.