Hai,
I have a problem where i can't display different items with the same table. I have a booking table where there are fields like date...time...name and etc. I have a field name sub_item_id in it too. I have another table where i have the description of this table and they are like below:-
sub_item_id sub_item_name item_id
1 conference room 1
2 projector 2
3 notebok 3
I could display the conference room details but i am not able to display the other items because i have not included the sub_item_id field in my query and it works but when i insert the sub_item_id for the projector i can't display the item. How should i do it?
Here is the code where i included the sub_item_id:
<cfloop from="1" to="7" index="ColCount" >
<cfset theday=DateAdd("d",ColCount-1, CreateDate(year,month,day))>
<cfset thenextday=DateAdd("d",1, theday)>
<cfquery name="new_cal" datasource ="bookings">
select * from booking
where start_time BETWEEN #theday# AND #thenextday#
</cfquery>
<cfoutput><td bgcolor="blue">
<div align="left"><font face="Arial, Helvetica, sans-serif" size="2" color="white">
<b>#DateFormat(theday,"dd-mmm-yyyy"#
</div></td></cfoutput>
</cfloop>
</tr>
<cfset thistime=700>
<cfloop index="RowCount" from="7" to="23">
<tr align="right" bgcolor="#FFFFCC">
<td>
<cfset thistime=thistime+30>
<cfoutput><b>
#timeformat(createtime(rowcount,0,0),"hh:mm tt"#</cfoutput></td>
<cfset detect=0>
<cfloop from="1" to="7" index="ColCount">
<cfset theday=DateAdd("d",ColCount-1,CreateDate(year,month,day))>
<cfset first_hour=DateAdd("h",RowCount-detect,theday)>
<cfset last_hour=DateAdd("n",59,first_hour)>
<cfquery name="new_cal" datasource ="bookings">
select * from booking
where sub_item_id=2 and (start_time BETWEEN #first_hour#
AND #last_hour# )
</cfquery>
<cfif new_cal.RecordCount NEQ 0>
<cfoutput query="new_cal">
<td bgcolor="CCCCCC"><a href="view1.cfm?bid=#b_id#">Booked</a>
</cfoutput>
<cfset detect=detect+1>
<cfelse>
<cfset detect=0>
<td>
</cfif>
<cfoutput> </cfoutput>
</td>
</cfloop>
I am displaying my data in a table form...where my rows are time and my columns are date. The problem is if i were to take out the code sub_item_id=2 from the query below
select * from booking where sub_item_id=2 and (start_time BETWEEN #first_hour# AND #last_hour# )
then the information goes into the conference room data which i have saved as a different name. Well how do i display my information without interfering the other fields.
Regards,
Dip.
I have a problem where i can't display different items with the same table. I have a booking table where there are fields like date...time...name and etc. I have a field name sub_item_id in it too. I have another table where i have the description of this table and they are like below:-
sub_item_id sub_item_name item_id
1 conference room 1
2 projector 2
3 notebok 3
I could display the conference room details but i am not able to display the other items because i have not included the sub_item_id field in my query and it works but when i insert the sub_item_id for the projector i can't display the item. How should i do it?
Here is the code where i included the sub_item_id:
<cfloop from="1" to="7" index="ColCount" >
<cfset theday=DateAdd("d",ColCount-1, CreateDate(year,month,day))>
<cfset thenextday=DateAdd("d",1, theday)>
<cfquery name="new_cal" datasource ="bookings">
select * from booking
where start_time BETWEEN #theday# AND #thenextday#
</cfquery>
<cfoutput><td bgcolor="blue">
<div align="left"><font face="Arial, Helvetica, sans-serif" size="2" color="white">
<b>#DateFormat(theday,"dd-mmm-yyyy"#
</div></td></cfoutput>
</cfloop>
</tr>
<cfset thistime=700>
<cfloop index="RowCount" from="7" to="23">
<tr align="right" bgcolor="#FFFFCC">
<td>
<cfset thistime=thistime+30>
<cfoutput><b>
#timeformat(createtime(rowcount,0,0),"hh:mm tt"#</cfoutput></td>
<cfset detect=0>
<cfloop from="1" to="7" index="ColCount">
<cfset theday=DateAdd("d",ColCount-1,CreateDate(year,month,day))>
<cfset first_hour=DateAdd("h",RowCount-detect,theday)>
<cfset last_hour=DateAdd("n",59,first_hour)>
<cfquery name="new_cal" datasource ="bookings">
select * from booking
where sub_item_id=2 and (start_time BETWEEN #first_hour#
AND #last_hour# )
</cfquery>
<cfif new_cal.RecordCount NEQ 0>
<cfoutput query="new_cal">
<td bgcolor="CCCCCC"><a href="view1.cfm?bid=#b_id#">Booked</a>
</cfoutput>
<cfset detect=detect+1>
<cfelse>
<cfset detect=0>
<td>
</cfif>
<cfoutput> </cfoutput>
</td>
</cfloop>
I am displaying my data in a table form...where my rows are time and my columns are date. The problem is if i were to take out the code sub_item_id=2 from the query below
select * from booking where sub_item_id=2 and (start_time BETWEEN #first_hour# AND #last_hour# )
then the information goes into the conference room data which i have saved as a different name. Well how do i display my information without interfering the other fields.
Regards,
Dip.