Ask a Question related to Coldfusion Database Access, Design and Development.
-
xSeanx #1
Testing a variable for inequality
What i'm doing is: if a searched term is not found in the database, it will
redirect the user back to the search page.
However, here is my problem, each time i compare the form input value against
the retrieved database value, nothing happens and it just continues on through
the rest of the code. What have i done wrong? it seems strange to me that a
blank field could still be equal to a field with a value.
The code:
<CFQUERY NAME="get_data" DATASOURCE="datasource">
SELECT * FROM CustomerDetails WHERE #Form.searchType# = '#Form.searchTerm#'
</CFQUERY>
<cfoutput query="get_data">
<cfif Form.searchTerm IS NOT CustomerID>
<cflocation url="url.com">
<cfelseif Form.searchTerm IS NOT CompanyName>
<cflocation url="url.com">
</cfif>
</cfoutput>
...
I've also tried using
<cfif CustomerID IS "">
But that did the exact same thing...
xSeanx Guest
-
#39251 [NEW]: variable variable class array property is read only
From: taskfreak at gmail dot com Operating system: mac os PHP version: 5.1.6 PHP Bug Type: Class/Object related Bug... -
inequality question
I'm having trouble trying to run a query that returns rows that don't match. The code below returns all the matching rows but what I need is all the... -
Checking inequality
I have the following code in one of my trigger functions --------------------------------------------------------------- IF... -
#22237 [Com]: PHP crashes when class references property using variable variable
ID: 22237 Comment by: rep at devdomain dot com Reported By: peter at globalvision dot com dot au Status: Closed... -
Testing for the existance of an Application() variable
How about this: theLetter="G" If len(Application(theLetter)) > 0 then HTH, Bob Barrows -
zoeski80 #2
Re: Testing a variable for inequality
You could just check how many records were returned from the query and make
your decision to redirect from there.
See attached code.
HTH
Zoe
<CFQUERY NAME="get_data" DATASOURCE="datasource">
SELECT *
FROM CustomerDetails
WHERE #Form.searchType# = '#Form.searchTerm#'
</CFQUERY>
<CFIF get_data.RecordCount EQ 0>
<cflocation url="url.com">
<CFELSE>
otherwise match was found ...
</CFIF>
zoeski80 Guest



Reply With Quote

