update record form
Hi, I'm trying to update a record and I keep getting an error that says pm_id is not defined in rsPmUpdate but I'm pretty sure it is. I'm using Dreamweaver CS4 to create the update form. Maybe it has something to do with what happens when I try to preview it-- when I try to preview it, I get a pop up that says:
Update Copy oin Testing Server?
This will update the file on testing server.
This might affect others working on the file. Proceed?
I was kind of scared to do it, but I clicked 'yes' but then was given another pop up:
Dependent Files
Put dependent files?
YOu can change this preferencde in the Site category of the preferences dialog.
What do those messages mean? They sound like they might mess with my site or database.
The file is called pmUpdateFORM.cfm. When I test my recordset with a test value, it shows that it is working correctly, and when I preview in firefox I add '?pm_id=(a number).
This is the code:
<cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>
<cfif IsDefined("FORM.MM_UpdateRecord") AND FORM.MM_UpdateRecord EQ "form1">
<cfquery datasource="mymindsnotrighttest">
UPDATE privatemessages
SET sender_id=<cfif IsDefined("FORM.sender_id") AND #FORM.sender_id# NEQ "">
<cfqueryparam value="#FORM.sender_id#" cfsqltype="cf_sql_numeric">
<cfelse>
NULL
</cfif>
, sent_to_id=<cfif IsDefined("FORM.sent_to_id") AND #FORM.sent_to_id# NEQ "">
<cfqueryparam value="#FORM.sent_to_id#" cfsqltype="cf_sql_numeric">
<cfelse>
NULL
</cfif>
, pmtitle=<cfif IsDefined("FORM.pmtitle") AND #FORM.pmtitle# NEQ "">
<cfqueryparam value="#FORM.pmtitle#" cfsqltype="cf_sql_clob" maxlength="65535">
<cfelse>
''
</cfif>
, pmcontent=<cfif IsDefined("FORM.pmcontent") AND #FORM.pmcontent# NEQ "">
<cfqueryparam value="#FORM.pmcontent#" cfsqltype="cf_sql_clob" maxlength="2147483647">
<cfelse>
''
</cfif>
, read=<cfif IsDefined("FORM.read") AND #FORM.read# NEQ "">
<cfqueryparam value="#FORM.read#" cfsqltype="cf_sql_clob" maxlength="65535">
<cfelse>
''
</cfif>
, date=<cfif IsDefined("FORM.date") AND #FORM.date# NEQ "">
<cfqueryparam value="#FORM.date#" cfsqltype="cf_sql_timestamp">
<cfelse>
NULL
</cfif>
, sender_username=<cfif IsDefined("FORM.sender_username") AND #FORM.sender_username# NEQ "">
<cfqueryparam value="#FORM.sender_username#" cfsqltype="cf_sql_clob" maxlength="65535">
<cfelse>
''
</cfif>
WHERE pm_id=<cfqueryparam value="#FORM.pm_id#" cfsqltype="cf_sql_numeric">
</cfquery>
<cflocation url="pmReadTABLE.cfm">
</cfif>
<form name="form1" method="POST" action="<cfoutput>#CurrentPage#</cfoutput>">
<table width="75%" border="0" cellpadding="4">
<tr>
<td width="13%">pm_id</td>
<td width="87%"><cfoutput>#rsPmUpdate.pm_id#</cfoutput> <input name="pm_id" type="hidden" id="pm_id" value="<cfoutput>#rsPmUpdate.pm_id#</cfoutput>"></td>
</tr>
<tr>
<td>sender_id</td>
<td><label>
<input name="sender_id" type="text" id="sender_id" value="<cfoutput>#rsPmUpdate.sender_id#</cfoutput>">
</label></td>
</tr>
<tr>
<td>sent_to_id</td>
<td><label>
<input name="sent_to_id" type="text" id="sent_to_id" value="<cfoutput>#rsPmUpdate.sent_to_id#</cfoutput>">
</label></td>
</tr>
<tr>
<td>pmtitle</td>
<td><label>
<input name="pmtitle" type="text" id="pmtitle" value="<cfoutput>#rsPmUpdate.pmtitle#</cfoutput>">
</label></td>
</tr>
<tr>
<td>pmcontent</td>
<td><label>
<textarea name="pmcontent" id="pmcontent" cols="45" rows="5"><cfoutput>#rsPmUpdate.pmcontent#</cfoutput></textarea>
</label></td>
</tr>
<tr>
<td>read</td>
<td><label>
<input name="read" type="text" id="read" value="<cfoutput>#rsPmUpdate.read#</cfoutput>">
</label></td>
</tr>
<tr>
<td>date</td>
<td><label>
<input name="date" type="text" id="date" value="<cfoutput>#rsPmUpdate.date#</cfoutput>">
</label></td>
</tr>
<tr>
<td>sender_username</td>
<td><label>
<input name="sender_username" type="text" id="sender_username" value="<cfoutput>#rsPmUpdate.sender_username#</cfoutput>">
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="submit" id="submit" value="Submit">
</label></td>
</tr>
</table>
<input type="hidden" name="MM_UpdateRecord" value="form1">
</form>
<cfparam name="URL.pm_id" default="1">
<cfquery name="rsPmUpdate" datasource="mymindsnotrighttest">
SELECT *
FROM privatemessages
WHERE pm_id = <cfqueryparam value="#URL.pm_id#" cfsqltype="cf_sql_numeric">
</cfquery>