Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Error

Status
Not open for further replies.

fusionaire

Programmer
May 20, 2000
67
US
I have a query that I am trying to run, I believe I have all the necessary elelments there, but even when I enter the correct information, CF still goes to the CFLocation page. Here is the code:<br><br>&lt;!-- ZIPCODE VALIDATION TEST --&gt;<br> &lt;cfoutput&gt;#FORM.Zip#&lt;/cfoutput&gt;<br> &lt;cfquery name=&quot;ZipTest&quot; datasource=&quot;#session.dsn#&quot;&gt;<br> SELECT ZIP<br> FROM Zipcode_Territory <br> &lt;/cfquery&gt;<br> <br> &lt;cfoutput query=&quot;ZipTest&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#ziptest.zip#<br> &lt;/cfoutput&gt;<br> <br> &lt;cfif ziptest.zip NEQ FORM.zip&gt;<br> &lt;CFLOCATION URL=&quot;nonres.cfm&quot; ADDTOKEN=&quot;no&quot;&gt;<br> &lt;/cfif&gt;<br><br>I am testing for the state of Pennsylvania, so I am only entering PA Zips. Even when I do add valid zips, CF goes to my CFlocation page. Any advice would be much appreciated.<br>
 
don't you have extra white spaces ?? trim the fields and tell me ??
 
I am looking to see where I may have extra white space, but I do not see them. Another issue that has arisen is that This query works properly if I choose the FIRST Zipcode listed in the fiels (in this case, that is 15001). ANY other zip that I pick sends me to my cflocation page. That is the progress so far.
 
Good news, I got this query to work, now on to the next one....testing, testing, testing...
 
Investigate putting a where clause in your select<br>statement. As it is, you are selecting all zip codes.<br>There may be other problems, but this is the one I saw.<br><br>jkellow
 
hey ! jkellow you're right !!!! but the where clause won't do the trick, something like &lt;cfif ziptest.zip contains form.zip&gt; sounds more like what fusionaire's looking for ...<br>keep on testing, have fun ;]]] !!<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top