troubleshooting Question

Update table query won't actually update the table.

Avatar of Klainn
Klainn asked on
Web Servers
8 Comments1 Solution356 ViewsLast Modified:
What I am attempting to do is take 3 values passed from a url (GlobalID, Type, and StartDate) as I believe these should distinguish one row from another. The variables are passed to the getInfo query and I can verify that they are being passed as I output them below via getInfo.GlobalID, getInfo.Type, and getInfo.StartDate. When I process the form, the query to update the table and set the Status and Occurrence fields do not update and no error is thrown. It's probably something easy I've overlooked, but I can't see it.

Help!

Here are some variables being passed.. timeoff_admin.cfm?GlobalID=2037503&Type=Vacation&StartDate=11/01/2006

The error I get now (before the form will even load) is "Invalid data URL.GlobalID for CFSQLTYPE CF_SQL_INTEGER."

All the tables share GlobalID as the key and they are all data types of INT



<!--- Take values from Mypage and query database with them --->
<!--- End Take values from Mypage and query database with them --->
<!--- Check if form is submitted and process --->
<cfif IsDefined('form.timeoff')>
<cfquery datasource="csc">
UPDATE Timeoff
SET Status='#FORM.Status#', Occurrence='#FORM.Occurrence#'
WHERE GlobalID = '#FORM.GlobalID#'
AND Type = '#FORM.Type#'
AND StartDate = '#FORM.StartDate#'
</cfquery>
     <cfif #FORM.Status# IS "Denied">
          <cfmail to="#getInfo.Email#" from="Service Desk Supervisors" subject="Your #getInfo.Type# request for #getInfo.StartDate# to #getInfo.EndDate# has been #FORM.Status#" type="html">
          Your request has been #FORM.Status# for the following reasons:<br />
          #FORM.Reason#
          </cfmail>
     <cfelseif #FORM.Status# IS "Approved">
          <cfmail to="#getInfo.Email#" from="Service Desk Supervisors" subject="Your #getInfo.Type# request for #getInfo.StartDate# to #getInfo.EndDate# has been #FORM.Status#" type="html">
          Your request has been #FORM.Status# and is on the calendar.<br />
          </cfmail>
     </cfif>
<script language="javascript" type="text/javascript">
opener.window.location.reload();
self.close();
</script>
<cfelse>
<cfparam name="URL.GlobalID" default="1">
<cfparam name="URL.Type" default="1">
<cfparam name="URL.StartDate" default="1">
<cfquery datasource="csc" name="getInfo">
SELECT *
FROM Timeoff
WHERE GlobalID = <cfqueryparam value="URL.GlobalID" cfsqltype="cf_sql_integer">
AND Type = <cfqueryparam value="URL.Type">
AND StartDate = <cfqueryparam value="URL.StartDate">
</cfquery>
<cfoutput>
#getInfo.GlobalID#<br />
#getInfo.Type#<br />
#getInfo.StartDate#<br />
</cfoutput>
<form action="<cfoutput>#CGI.SCRIPT_NAME#</cfoutput>" method="post">
<select name="Status" size="1">
<option value="Approved">Approved</option>
<option value="Denied">Denied</option>
</select><br />
Occurrence: <input type="text" name="Occurrence" /><br />
If request is denied, submit reason:<br />
<textarea name="Reason" cols="80%" rows="10"></textarea>
<input type="hidden" name="GlobalID" value="#getInfo.GlobalID#" />
<input type="hidden" name="Type" value="#getInfo.Type#" />
<input type="hidden" name="StartDate" value="#getInfo.StartDate#" />
<input type="submit" name="timeoff" value="Approve / Deny Request" class="submitbutton" />
</form>
</cfif>
<!--- End Check if form is submitted and process --->
ASKER CERTIFIED SOLUTION
gdemaria

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros