Jerome Slaughter
asked on
Update/Edit data on developed webpage using coldfusion
I am using the code below on a web page I developed to update/edit some data using coldfusion. Currently when I click the "edit button" for some of the records displayed I do not get an error but the data update does not happen successfully. For some other records I try to update on the webpage I get the following error message when clicking the edit button "Invalid data 18,18 for CFSQLTYPE CF_SQL_INTEGER." What am I doing wrong?
<!-- If URL.From is defined and equals DoEdit, then update the table -->
<CFIF IsDefined("URL.From")>
<CFIF #URL.From# IS "DoEdit">
<CFUPDATE DATASOURCE="SSPSRs" TABLENAME="Issues">
</CFIF>
</CFIF>
<!-- The below code selects all data from the table -->
<CFQUERY NAME="all" DATASOURCE="SSPSRs">
select * from Issues where user_name = <cfoutput>'#url.user_name#'</cfoutput>;
</CFQUERY>
<body>
<a href="trackertabs.cfm?user_name=<cfoutput>#url.user_name#</cfoutput>&tab=2">
<img src="http://127.0.0.1:8500/TicketTracking/pics/imagesCA6WFWX0.jpg" width=50 height=50 alt="go back to service tab" border="0" /></a>
</body>
<br>
<body>
<center>
<font size=6>
My Service Requests (All)
</font>
</center>
<br>
</body>
<body>
<!-- If DoUpdate has been run a short note is given -->
<CFIF IsDefined("DoUpdate.RecordCount")>
<p><b>Thanks for your update!</b>
</CFIF>
<table border='0' width='100%' align='center' summary='script output'>
<tr bgcolor="#d3d3d3">
<th bgcolor="#d3d3d3"><font size=2><b>Service<br> Request #</b></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Request</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Network</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Assigned To</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Customer</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Opened Date</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Closed Date</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Status</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Priority</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Description</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Date Completed</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Comments</strong></font></th>
<th></th>
</tr>
<!-- Here we check for the URL.From attribute -->
<CFIF IsDefined("URL.From")>
<!-- If URL.From just equals DoEdit, we simply just output the data, just as if it was undefined -->
<CFIF #URL.From# IS "DoEdit">
<cfoutput query="all">
<tr>
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Customer#</font></td>
<td><font size=2>#DateFormat(Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>
<!-- This is where the Edit button and form is created -->
<td>
<form action="mysrs.cfm?user_name=#url.user_name#&From=Edit&ID=#Ticket_num#" method="post">
<input type="submit" value="Edit">
</form>
</td>
</tr>
</CFOUTPUT>
<CFELSE>
<CFLOOP QUERY="all">
<CFIF #URL.ID# IS #all.Ticket_Num#>
<CFOUTPUT>
<form action="mysrs.cfm?user_name=#url.user_name#&From=DoEdit&ID=#Ticket_num#" method="post">
<tr>
<td><font size=2><input type="text" name="Ticket_num" size="10" value="#Ticket_num#"></font></td>
<td><font size=2><input type="select" name="Title" size="25" value="#Title#"></font></td>
<td><font size=2><input type="text" name="Network" size="15" value="#Network#"></font></td>
<td><font size=2><input type="text" name="Assigned_To" size="25" value="#Assigned_To#"></font></td>
<td><font size=2><input type="text" name="Customer" size="25" value="#Customer#"></font></td>
<td><font size=2><input type="text" name="Opened_Date" size="15" value="#DateFormat(Opened_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Closed_Date" size="15" value="#DateFormat(Closed_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Status" size="15" value="#Status#"></font></td>
<td><font size=2><input type="text" name="Priority" size="15" value="#Priority#"></font></td>
<td><font size=2><input type="text" name="Description" size="30" value="#Description#"></font></td>
<td><font size=2><input type="text" name="Date_Completed" size="15" value="#Date_Completed#"></font></td>
<td><font size=2><input type="text" name="Comments" size="50" value="#Comments#"></font></td>
</tr>
</CFOUTPUT>
<CFELSE>
<!-- This is where all the data get's nicely output into the table -->
<cfoutput>
<tr>
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Customer#</font></td>
<td><font size=2>#DateFormat(Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>
<td>
</td>
</tr>
</CFOUTPUT>
</CFIF>
</CFLOOP>
</CFIF>
<!-- If URL.From is undefined -->
<CFELSE>
<CFOUTPUT QUERY="all">
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('efefef'))#">
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Customer#</font></td>
<td><font size=2>#DateFormat(all.Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(all.Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>
<!-- This is where the Edit button and form is created -->
<td>
<form action="mysrs.cfm?user_name=#url.user_name#&From=Edit&ID=#Ticket_num#" method="post">
<input type="submit" value="Edit">
</form>
</td>
</tr>
</CFOUTPUT>
</CFIF>
<!-- If URL.From is defined and equals Edit, then display an update button and close the form -->
<CFIF IsDefined("URL.From")>
<CFIF #URL.From# IS "Edit">
<tr>
<td colspan="3">
<CFOUTPUT>
<input type="hidden" name="Ticket_num" value="#URL.ID#">
</CFOUTPUT>
<input type="submit" value="Update">
</form>
</td>
</tr>
</CFIF>
</CFIF>
</table>
</body>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER