Max is a function. Don't use it as a column name. On Thu, Mar 26, 2009 at 12:27 PM, Adam Parker <[email protected]> wrote: > > Hello again - > > It seems as though my reasoning is not working out after all. The queries > that I am using to get a list of upcoming events is: > > <cfquery name="getEvents" datasource="myDSN"> > SELECT id, unit, date, description, title, day, time, location, max, > excludeReg > FROM EVENTS > WHERE > (((unit='CTL' or unit='Special' or cosponsor like '%CTL%') and date >= > #now()# and approved=YES and advertiseWeb=YES) or > ((unit='CTL' or unit='Special' or cosponsor like '%CTL%' or cosponsor > like '%IUSM%') and date Is Null and approved=YES and advertiseWeb=YES))ORDER > BY date asc > </cfquery> > > This is the query to count the number of attendees registered for the event: > > <cfquery name="getAttendance" datasource="myDSN"> > SELECT count(eventID) as eventCount > FROM EventAttendance > WHERE eventID = <cfqueryparam cfsqltype="cf_sql_integer" > value="#getEvents.id#" /> > </cfquery> > > (The eventID is added to the table each time someone registers for the event.) > > This is a portion of the content of the page that includes the queries and > logic to determine if the event has met its maximum number of available seats: > > <cfoutput query="getEvents"> > <p><strong>#title#</strong></p> > <cfif getAttendance.eventCount GTE getEvents.max> > <p class="eventFull">Event Full</p> > <cfelse> > </cfif> > </p> > <p>When: #DateFormat(date, "full")# | #time# <br /> > Where: #location#</p> > </cfoutput> > > With the way the code is now, events that hold 100 people are appearing full > with just two people registered. I have looked over my queries and don't see > any apparent error. Could someone lend another set of eyes and insight as to > what may be wrong? > > Thanks, > Adam > >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4490 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
