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

table problem

Status
Not open for further replies.

dip

Programmer
Aug 15, 2000
20
SG
I have created a booking table for the intranet system.&nbsp;&nbsp;I have created a table containing date and time.&nbsp;&nbsp;The date is displayed in the column and the time is through the row.&nbsp;&nbsp;If anyone books on a certain date and time, the column and row consisting of the time and date will be displayed with the word BOOKED. <br>&nbsp;My major problem here is that for example if i were to book on the 15th at 10.00am the word Booked will appear at the column and row which was chosen, but if i were to book on 16th (the next day) with the same time, the information on 16th will not be shown on the grid unless i delete the 15th information or i have to delete the 16th information to get the 15th information.<br><br>&nbsp;Here is the code which generates the date and time :<br><br>The code below generates the date:<br><br>&lt;cfloop from=&quot;1&quot; to=&quot;7&quot; index=&quot;ColCount&quot; &gt;<br> &lt;cfset theday=DateAdd(&quot;d&quot;,ColCount-1, CreateDate(year,month,day))&gt;<br> &lt;cfset thenextday=DateAdd(&quot;d&quot;,1, theday)&gt;<br> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfquery name=&quot;new_cal&quot; datasource =&quot;bookings&quot;&gt;<br> select * from booking<br> where start_time BETWEEN #theday# AND #thenextday#<br> &nbsp;&nbsp;&nbsp;&lt;/cfquery&gt; <br> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfoutput&gt;&lt;td bgcolor=&quot;blue&quot;&gt;<br>&nbsp;&lt;div align=&quot;left&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot; color=&quot;white&quot;&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;b&gt;#DateFormat(theday,&quot;dd-mmm-yyyy&quot;)#<br> &nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/cfoutput&gt;<br>&lt;/cfloop&gt; <br><br>The code below is where i generated the time :<br><br>&lt;cfset thistime=700&gt; <br>&lt;cfloop index=&quot;RowCount&quot; from=&quot;7&quot; to=&quot;23&quot;&gt;<br> &lt;tr align=&quot;right&quot; bgcolor=&quot;#FFFFCC&quot;&gt;<br> &lt;td&gt;<br> &lt;cfset thistime=thistime+30&gt;<br> <br> &lt;cfoutput&gt;&lt;b&gt;<br> #timeformat(createtime(rowcount,0,0),&quot;hh:mm tt&quot;)#&lt;/cfoutput&gt;&lt;/td&gt;<br> &lt;cfset detect=0&gt;<br> &lt;cfloop from=&quot;1&quot; to=&quot;7&quot; index=&quot;ColCount&quot;&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset theday=DateAdd(&quot;d&quot;,ColCount-1,CreateDate(year,month,day))&gt; <br> &lt;cfset first_hour=DateAdd(&quot;h&quot;,RowCount-detect,theday)&gt;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset last_hour=DateAdd(&quot;n&quot;,59,first_hour)&gt; <br> <br> &lt;cfquery name=&quot;new_cal&quot; datasource =&quot;bookings&quot;&gt;<br> select * from booking<br> where start_time BETWEEN #first_hour#<br> AND #last_hour#<br> &lt;/cfquery&gt;&nbsp;&nbsp;<br> <br> &lt;cfif new_cal.RecordCount NEQ 0&gt;<br> &lt;cfoutput query=&quot;new_cal&quot;&gt; <br> &nbsp;&nbsp;&nbsp;&lt;td bgcolor=&quot;CCCCCC&quot;&gt;&lt;a href=&quot;view.cfm?bid=#b_id#&quot;&gt;Booked&lt;/a&gt;<br> &lt;/cfoutput&gt;&nbsp;&nbsp;<br> &lt;cfset detect=detect+1&gt; <br> &nbsp;&nbsp;&nbsp;&nbsp;&lt;cfelse&gt;<br> &lt;cfset detect=0&gt;&nbsp;&nbsp;<br> &lt;td&gt;<br> &lt;/cfif&gt;&nbsp;&nbsp;<br> &nbsp;&lt;cfoutput&gt; &lt;/cfoutput&gt; <br> &lt;/td&gt;<br>&lt;/cfloop&gt; <br><br>I would be very grateful if you could help me on this as soon as possible as i have to launch it in my intranet already.&nbsp;&nbsp;Thank you.<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top