You can do like <cfparam name="Form.sku" default="1"><!--- added line <cfparam name="Form.pn" default="0"> ---><cfquery name="product" datasource="carbs"> SELECT Product_ID, Name, SKU, Description1, Description2, Vend_Name, Vend_Number, Image1, Image1ParamsFROM carbs.productsWHERE sku = <cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.sku#" maxlength="40" /> orVend_Number = <cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.pn#" maxlength="40" /> </cfquery> <p>SKU:<input type="text" name="SKU"> <input type="submit" value="Find"> Please enter the SKU Number and then click<strong>Find</strong>.<!--- ADDED OUTPUT LINE <br/>Vend_Number:<input type="text" name="Vend_Number"> <input type="submit" value="Find"> Please enter the Part Number and then click<strong>Find</strong>. ---></form> OR <cfparam name="Form.sku" default="1"><!--- added line <cfparam name="Form.pn" default="0"> ---> <cfparam name="Form.sku" default="1"><cfset whFlag = 0><cfquery name="product" datasource="carbs"> SELECT Product_ID, Name, SKU, Description1, Description2, Vend_Name, Vend_Number, Image1, Image1ParamsFROM carbs.productsWHERE <cfif "#FORM.sku#" neq "1"><!--- even you can plave condition as per your value---> sku = <cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.sku#" maxlength="40" /><cfset whFlag = 1> </cfif> <cfif whFlag eq 1> or </cfif>
<cfif "#FORM.pn#" neq "0"><!--- even you can plave condition as per your value---> Vend_Number = <cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.pn#" maxlength="40" /> </cfif> </cfquery> <p>SKU:<input type="text" name="SKU"> <input type="submit" value="Find"> Please enter the SKU Number and then click<strong>Find</strong>.<!--- ADDED OUTPUT LINE <br/>Vend_Number:<input type="text" name="Vend_Number"> <input type="submit" value="Find"> Please enter the Part Number and then click<strong>Find</strong>. ---></form> I tried, I hope it will give you some idea to solve your problem. Sincerely Hiren Patel From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: [ACFUG Discuss] Form Parameters and SQL Language for WHERE logicDate: Wed, 14 Mar 2007 07:27:01 -0500 I am trying to make a form where I can use a couple search fields. Right now I have a singe search variable: SKU, but I would like to use the same page and choose PN as well. You can see that I am trying to add Form.pn as a variable to use optionally as opposed to Form.sku in a different box. ---------------------------<cfparam name="Form.sku" default="1"><!--- added line <cfparam name="Form.pn" default="0"> ---><cfquery name="product" datasource="carbs"> SELECT Product_ID, Name, SKU, Description1, Description2, Vend_Name, Vend_Number, Image1, Image1ParamsFROM carbs.productsWHERE sku = <cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.sku#" maxlength="40" /><!--- added line orWHERE Vend_Number = <cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.pn#" maxlength="40" /> ---></cfquery> <p>SKU:<input type="text" name="SKU"> <input type="submit" value="Find"> Please enter the SKU Number and then click<strong>Find</strong>.<!--- ADDED OUTPUT LINE <br/>Vend_Number:<input type="text" name="Vend_Number"> <input type="submit" value="Find"> Please enter the Part Number and then click<strong>Find</strong>. ---></form> ---------------------------------- If I remove the <!--- ---> from this code I would need it to work. I konw the "OR" statement between the WHERE's is wrong. I cant find a way to make this statement and dont know how to word a search to find a way to do this. Any guidance out there what I need to use to do this? Robert P. Reil Managing Director, Motorcyclecarbs.com, Inc. 4292 Country Garden Walk NW Kennesaw, Ga. 30152 Office 770-974-8851 Fax 770-974-8852 www.motorcyclecarbs.com _________________________________________________________________ Call friends with PC-to-PC calling -- FREE http://get.live.com/messenger/overview ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------