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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have the following code what I am

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
GB
I have the following code what I am aiming to achieve is for the user when they enter a date and time that is booked the error message occurs but I then want the next avialble time to be displayed to the user for that date. I have another two tables in a database on is tblBooking which holds the fields BookingDate and BookingTime and the other table tblStartTimes which holds all of the times such as 08:00, 08:15 etc at 15 mins intervals to 20:00. What I expect to happen is that when the error is displayed below then the user will be presented with the next neares time from the tblStartTimes and also the BookingDate and this new selected time will have to be checked in the tblBookings again to make sure it is also not booked this will have to be done befor presenting to the user the next possible time?

Any ideas on how I can carry this out appreciated?

<CFOUTPUT QUERY=&quot;booking&quot;>
<CFSET bookdate = DateFormat(bookdate,&quot;mm/dd/yy&quot;)>
<CFSET booktime = TimeFormat(booktime,&quot;HH:mm&quot;)>
<cfif #bookdate# EQ #BookingDate# AND #booktime# EQ #BookingTime#>
Error
</cfif>
</CFOUTPUT>
 
I think there might be an easier way to do this by structuring your tables differently but I need to understand a little more about your app first. Are you trying to set up something that allows users to book something exclusively like a conference room? If so, it sounds like they can book it for anytime between 8 and 8 at 15 minute intervals. Is this correct?

If so, I think I can give you a way that will make it easy to check and present alternate times.
GJ
 
Yeah, and apart from that the comparison of dates/times looks tricky (with the EQ stuff). Why not try DateCompare instead? Good luck!


<webguru>iqof188</webguru>
 
GunJack your asumption is correct. The user enters a date and time to book if this is not available then the error above is displayed, however it would be ideal if the system then informed the user of the next available time nearest their original time. The times are held seperatley in a table as above. The booking info is entered into another table. The system would have to look for the next time and display this to the user as long as the same date and that time is not already booked.
 
Today's extremely busy so let me get back to you tomorrow. I'll think about it and see if I can give you a way to structure the tables to make it easy to check and suggest alternates. I don't think this will be too hard to modify.

GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top