I want to check a form variable against a value in the
database, if that value is not there, I then want to insert into
the datbase. If the value IS there, then I want to return what the
database has. I can do this in the code, but since I want to do
this in many different pages, I would like to make a UDF for this.
I tried but it does not appear to be working. The code that is
calling it is
If the date in the form is new, and not in the database, the
value is inserted into the db and the cflocation sends me back to
the index page (where the function is being called). If the value
IS in the database I get the following error.
####ERROR OUTPUT FROM SCREEN#####
The value returned from function getnewdate() is not of type
If the component name is specified as a return type, the
reason for this error might be that a definition file for such
component cannot be found or is not accessible.
The error occurred in C:\Inetpub\wwwroot\index.cfm: line 13
I can't be sure about this since I don't know what data's in
your DB, but based upon the logic you've got I am guessing it might
be due to the fact that your query returns more than 1 record.
According to your logic if no record exists a cflocation will abort
the current function. If EXACTLY 1 record exists then the query
datequery is returned, but if more than 1 record is returned then
nothing is done and CF will complain that there is no query being
returned even though you specified that there would be a return
type of query for your function.