RE: Newbyish Question (FORMS)
Also, if you're using a database engine that allows TSQL, then put the loop inside the CFQUERY and put a ; at the end of each INSERT This looks like a good tip, can this be done with other Databases as well? i.e. Oracle? Have always coded the loop outside the cfquery tag, anybody got any performance info on this? AFAIK, any of the big SQL engines, SQL Server, Oracle and such all deal with multiple requests in one query, this saves traffic to the database server... Why have I not thought of that before... it seems so obvious now :-) Will be putting it to the test later on this afternoon! You got any performance info on that? cfloop list=#form.Accomidations# index=x cfquery datasource=blah name=insertAccomidation insert into tblAccomidations (personKey, accomitationId) values(pid,x) /cfquery /cfloop Not forgetting to put #'s around your variables; insert into tblAccomidations (personKey, accomitationId) values(#pid#,#x#) Jeez, where have all the cfqueryparam's gone Sorry Philip, being a bit pedantic :-) ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Newbyish Question (FORMS)
Will be putting it to the test later on this afternoon! You got any performance info on that? This REALLY is something personal on your setup, you might find that your database handles multiple INSERTs really well, especially during light load, while during heavy load it sucks royally You have to test it yourself a lot as it's very specific to each setup (in my experience) I tend to do a LOT of work in the SQL rather than using SQL, CF, SQL... But that's because I've been expanding my SQL Server knowledge and am currently playing with new stuff g One thing I'll say is always test what you've done, don't expect it to be faster, just because you think it'll be faster ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Newbyish Question (FORMS)
Nice one Philip, will be checking it out when I get a bit of time :-) Will be putting it to the test later on this afternoon! You got any performance info on that? This REALLY is something personal on your setup, you might find that your database handles multiple INSERTs really well, especially during light load, while during heavy load it sucks royally You have to test it yourself a lot as it's very specific to each setup (in my experience) I tend to do a LOT of work in the SQL rather than using SQL, CF, SQL... But that's because I've been expanding my SQL Server knowledge and am currently playing with new stuff g One thing I'll say is always test what you've done, don't expect it to be faster, just because you think it'll be faster ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Newbyish Question (FORMS)
Code like below will produce a form field variable of Accomidations=1,3 in the checkTheBoxes.cfm if Hotel and Bed and Breakfast are both checked. html head titleUntitled/title /head body form name=chkBoxes action=checkTheBoxes.cfm method=post table cellspacing=0 cellpadding=0 border=0 tr tdAccomidation Type: Check as many as you want./td /tr tr tdinput name=Accomidations type=Checkbox value=11. Hotel/td /tr tr tdinput name=Accomidations type=Checkbox value=22. Guest House/td /tr tr tdinput name=Accomidations type=Checkbox value=33. Bed and Breakfast/td /tr tr tdinput name=Accomidations type=Checkbox value=44. Self Catering/td /tr tr tdnbsp;/td /tr tr tdinput name=submit type=Submit value=Submit/td /tr /table /form /body /html ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Newbyish Question (FORMS)
Sorry... Forgot the sql part: Code like below will produce a form field variable of Accomidations=1,3 in the checkTheBoxes.cfm if Hotel and Bed and Breakfast are both checked. html head titleSelect Multi Boxes/title /head body form name=chkBoxes action=checkTheBoxes.cfm method=post table cellspacing=0 cellpadding=0 border=0 tr tdAccomidation Type: Check as many as you want./td /tr tr tdinput name=Accomidations type=Checkbox value=11. Hotel/td /tr tr tdinput name=Accomidations type=Checkbox value=22. Guest House/td /tr tr tdinput name=Accomidations type=Checkbox value=33. Bed and Breakfast/td /tr tr tdinput name=Accomidations type=Checkbox value=44. Self Catering/td /tr tr tdnbsp;/td /tr tr tdinput name=submit type=Submit value=Submit/td /tr /table /form /body /html Here is the checkTheBoxes.cfm... !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head titleCheck The Boxes/title /head body cfoutput cfif isDefined(form.Accomidations) cfloop list=#form.Accomidations# index=x cfquery datasource=blah name=insertAccomidation insert into tblAccomidations (personKey, accomitationId) values(pid,x) /cfquery /cfloop /cfif /cfoutput /body /html ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Newbyish Question (FORMS)
cfloop list=#form.Accomidations# index=x cfquery datasource=blah name=insertAccomidation insert into tblAccomidations (personKey, accomitationId) values(pid,x) /cfquery /cfloop Not forgetting to put #'s around your variables; insert into tblAccomidations (personKey, accomitationId) values(#pid#,#x#) Otherwise your SQL will break immediately Also, if you're using a database engine that allows TSQL, then put the loop inside the CFQUERY and put a ; at the end of each INSERT ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Newbyish Question (FORMS)
Main question first.. Also, if you're using a database engine that allows TSQL, then put the loop inside the CFQUERY and put a ; at the end of each INSERT This looks like a good tip, can this be done with other Databases as well? i.e. Oracle? Have always coded the loop outside the cfquery tag, anybody got any performance info on this? cfloop list=#form.Accomidations# index=x cfquery datasource=blah name=insertAccomidation insert into tblAccomidations (personKey, accomitationId) values(pid,x) /cfquery /cfloop Not forgetting to put #'s around your variables; insert into tblAccomidations (personKey, accomitationId) values(#pid#,#x#) Jeez, where have all the cfqueryparam's gone can somebody tell me if there is a reason *not* to use them in a hard coded query? Should be using them all the time where possible (unless your an uber coder and you just *know* the reason on why not to use them in that particular instance) DC ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Newbyish Question (FORMS)
Also, if you're using a database engine that allows TSQL, then put the loop inside the CFQUERY and put a ; at the end of each INSERT This looks like a good tip, can this be done with other Databases as well? i.e. Oracle? Have always coded the loop outside the cfquery tag, anybody got any performance info on this? AFAIK, any of the big SQL engines, SQL Server, Oracle and such all deal with multiple requests in one query, this saves traffic to the database server... cfloop list=#form.Accomidations# index=x cfquery datasource=blah name=insertAccomidation insert into tblAccomidations (personKey, accomitationId) values(pid,x) /cfquery /cfloop Not forgetting to put #'s around your variables; insert into tblAccomidations (personKey, accomitationId) values(#pid#,#x#) Jeez, where have all the cfqueryparam's gone can somebody tell me if there is a reason *not* to use them in a hard coded query? Should be using them all the time where possible (unless your an uber coder and you just *know* the reason on why not to use them in that particular instance) Yes, you SHOULD be using them whenever there is a CF value, I was just using it without as the original code sample wasn't referring to the CF variables at all The big problem with them is that if you expect an Integer and it's being passed a Varchar, then you have to trap the error yourself with CFTRY... But you can get around this by dealing with any non-numerics before the query... I'm a BIG advocate of CFQUERY as it speeds up your queries as well as the validation (depending on your database engine - Your Mileage May Vary) ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Newbyish Question (FORMS)
How I handle this is I pass the form search values to a action page for processing and I feed the multiple form vars as delimited file using (#ListQualify(form.vars,')#) I also check to see if a useable value is passed and build the query on that. so it would look something like this SELECT pid1, pid2 FROM pid_table WHERE pid_display = 'Yes' cfif form.search1 NEQ '' AND pid1 in (#ListQualify(form.search1,')#) /cfif cfif form.search2 NEQ '' AND pid1 in (#ListQualify(form.search2,')#) /cfif -Original Message- From: Mark Stephenson - Evolution Internet [mailto:[EMAIL PROTECTED] Sent: Monday, June 09, 2003 3:02 PM To: CF-Talk Subject: Newbyish Question (FORMS) Hey, A bit out of practice, whats the best way to manage mulitple choice 'Search' forms Its for an accomodation guide... I.E.1. Accomodation Types 2. Hotel 3. Guest Houses 4. Bed Breakfast 5. Self Catering A user picks 1 5 from the checkboxes How should i set up my dbase to keep the info... and home do i do the multiple choice question.. I've been doing some project management in a completely unrelated field (transport!) and my mind has gone blank. Were using MX. Kind Regards, Mark Stephenson New Media Director Evolution Internet T: 0870 757 1631 F: 0870 757 1632 W: www.evolutioninternet.co.uk E: [EMAIL PROTECTED] WARNING: --- The information contained in this document and attachments is confidential and intended only for the person(s) named above. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution, or any other use of the information is strictly prohibited. If you have received this document by mistake, please notify the sender immediately and destroy this document and attachments without making any copy of any kind. AVIS IMPORTANT: --- Les informations contenues dans le present document et ses pieces jointes sont strictement confidentielles et reservees a l'usage de la (des) personne(s) a qui il est adresse. Si vous n'etes pas le destinataire, soyez avise que toute divulgation, distribution, copie, ou autre utilisation de ces informations est strictement prohibee. Si vous avez recu ce document par erreur, veuillez s'il vous plait communiquer immediatement avec l'expediteur et detruire ce document sans en faire de copie sous quelque forme. ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Host with the leader in ColdFusion hosting. Voted #1 ColdFusion host by CF Developers. Offering shared and dedicated hosting options. www.cfxhosting.com/default.cfm?redirect=10481 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4