SunQuest
           ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old March 28th, 2005, 03:52 PM
charmed0rz charmed0rz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 142 charmed0rz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 49 m 31 sec
Reputation Power: 5
Better way to do this

I know this code has ALOT going on.. so i would understand it loading like 5 times slower then the other pages... but instead it's timing out 9/10 of the time! what else can i do?

Search Page:
Battle Search:<br><br></center>
<form action="battlesearchaction.cfm" method="post">
Level Between: <input type="text" size="5" name="Level1"> - <input type="text" size="5" name="Level2">
<br><br>
HP between: <input type="text" size="5" name="HP1"> - <input type="text" size="5" name="HP2">
<br><br>
Alignment: <SELECT SIZE="1" NAME="align_name">
<OPTION VALUE="">Any</OPTION>
<OPTION VALUE="Devil">Devil</OPTION><OPTION VALUE="Angel">Angel</OPTION></select><br><br>
Alignment Between: <input type="text" size="5" name="Align1"> - <input type="text" size="5" name="Align2"><br><br>
Pocket between: <input type="text" size="5" name="pocket1"> - <input type="text" size="5" name="pocket2"><br><br>
Gender: <SELECT SIZE="1" NAME="gender">
<OPTION VALUE="">Any</OPTION>
<OPTION VALUE="Male">Male</OPTION><OPTION VALUE="Female">Female</OPTION></select><br><br>
<input type="submit" value="Search!">



Search Action:
<cfparam name="form.Level1" default="">
<cfparam name="form.Level2" default="">
<cfparam name="form.HP1" default="">
<cfparam name="form.HP2" default="">
<cfparam name="form.align1" default="">
<cfparam name="form.align2" default="">
<cfparam name="form.pocket1" default="">
<cfparam name="form.pocket2" default="">

<cfquery name="get_user" datasource="aeris7282">
Select battle.user_level, battle.HP, battle.maxhp, battle.user_name, battle.user_ID, battle.alignment, battle.alignmentamount, finance.pocket, casual.user_gender
From battle, finance, casual
WHERE 0=0
AND battle.user_id = finance.user_ID
AND casual.user_ID = battle.user_ID
<cfif len(form.Level1)>
AND user_Level >= #form.Level1#
</cfif>
<cfif len(form.Level2)>
AND user_Level <= #form.Level2#
</cfif>
<cfif len(form.HP1)>
AND HP >= '#form.HP1#'
</cfif>
<cfif len(form.HP2)>
AND HP <= '#form.HP2#'
</cfif>
<cfif len(form.align1)>
AND AlignmentAmount >= '#form.align1#'
</cfif>
<cfif len(form.align2)>
AND AlignmentAmount <= '#form.align2#'
</cfif>
<cfif len(form.pocket1)>
AND pocket >= '#form.pocket1#'

</cfif>
<cfif len(form.pocket2)>
AND pocket <= '#form.pocket2#'
</cfif>
<cfif #form.align_name# is 'Any'>
AND Alignment = 'Angel' OR Alignment = 'Devil'
</cfif>
<cfif #form.align_name# is 'Angel'>
AND Alignment = 'Angel'
</cfif>
<cfif #form.align_name# is 'Devil'>
AND Alignment = 'Devil'
</cfif>

<cfif #form.gender# is 'Any'>
AND user_gender = 'Male' OR user_gender = 'Female'
</cfif>
<cfif #form.gender# is 'Male'>
AND user_gender = 'Male'
</cfif>
<cfif #form.gender# is 'Female'>
AND user_gender = 'Female'
</cfif>
</cfquery>
<cfoutput query="get_user">
<b><a href="viewaccount.cfm?user_Id=#user_ID#">#User_name#</a></b> <br>
<b>Max HP:</b> #maxhp#<br>
<b>Status:</b> <cfif HP LTE '0'>Dead<cfelse>Alive</cfif> <br>
<b>Alignment:</b> <cfif alignment is 'Angel'>Angel<cfelse>Devil</cfif><br>
<b>Amount:</b> #alignmentamount#<br>
| <a href="battles.cfm?user_ID=#user_ID#">Attack</a> | <a href="sendmail.cfm?user_ID=#user_ID#">Send Mail</a> |<br>
<br>
</cfoutput>

Reply With Quote
  #2  
Old March 29th, 2005, 08:45 AM
fortunato fortunato is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 33 fortunato User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 36 m 52 sec
Reputation Power: 4
Unfortunately nothing jumps right out at me.
It is most likely the query that is slowing the page down. If you turn on CF debugging and check the data, it will show you how long it took to run the query (the time it actually makes it through) . If the query is slow, its a matter of tuning your sql, and data structure to perform better, If the query runs reasonably, the other possible suspect would be sheer volume of records returned/output. This may lead to an overly large page size.

Reply With Quote
  #3  
Old March 29th, 2005, 02:39 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
Always separate data (queries, logic, etc.) from presentation and markup. I agree that the query is probably the cause of the timeout. You should be able to turn on debugging and see the execution time of any queries that ran during the request.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Better way to do this


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway