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

Creating a TV Guide advancing by day

Status
Not open for further replies.

rojas1mg

Programmer
Jun 15, 2004
119
US
I have an app that our Audio/Visual department uses to post their TV Guide. What I'd like to do is build a query that'll allow the user to click the Forward or Back buttons to view different days. Anyone create anything like this?

rojas1mg - - - I love Tek-Tips and all members who reply.
 
This could help.

Code:
<cfoutput>

<cfset today = "#now()#">
<cfparam name="thisday" default="#today#">
<cfset nextday = #dateadd("d",1,"#thisday#")#>
<cfset lastday = #dateadd("d",-1,"#thisday#")#>
<cfset datetoshow = "#thisday#">

		
<!---This query will get the current day's TV Guide--->
<cfquery name="getguide" datasource="#dsource#">
	SELECT *
	FROM tbl_guide
	WHERE guide_DT = #thisday#
</cfquery>

<title>#title# for #DateFormat(Now(), "DD MMM YY")#</title>
<body>
<h2>#title#</h2>
<h3>#DateFormat(Now(), "DD MMM YY")#</h3>
<cfif getguide.recordcount GT 0>
<table width="300" border="1" class="header"><tr bgcolor="white"><td width="15%" align="center"><a title="View the Previous day" href="default.cfm?thisday=#dateformat(lastday,"mm/dd/yyyy")#"><font><<</font></a></td><td width="70%" align="center">#dateformat(thisday,"mm/dd/yyyy")#</td><td width="15%" align="center"><a title="View the Next day" href="default.cfm?thisday=#dateformat(nextday,"mm/dd/yyyy")#"><font>>></font></a></td></tr>
	<TR class="header">
		<TD>CHANNEL</TD>
		<TD>HOURS</TD>
		<TD>PROGRAM</TD>
	</TR>
<cfloop query="getguide">
	<TR class="guide-sub">
		<!---<TD>&nbsp;</TD>--->
		<TD>#getguide.guide_ch#</TD>
		<TD>#getguide.guide_time#</TD>
		<TD>#getguide.guide_tx#</TD>
	</TR>
</cfloop>
<cfelse>
<p class="warnl">Currently there is no TV Guide listing.</p>
</cfif>
</table>

</body>
</html>
</cfoutput>

rojas1mg - - - I love Tek-Tips and all members who reply.
 
I get the page to display the current date in the table and when I advance in the >>> or go back using the <<<, the date changes. However, my question lies in the query I guess. I can't get it to display the data for the date advanced or back. Help.

rojas1mg - - - I love Tek-Tips and all members who reply.
 
I got it. Here's my code. Thanks anyway.

Code:
<cfoutput>

<cfset today = "#now()#">
<cfparam name="thisday" default="#today#">
<cfset nextday = #dateadd("d",1,"#thisday#")#>
<cfset lastday = #dateadd("d",-1,"#thisday#")#>
<cfset datetoshow = "#thisday#">

		
<!---This query will get the current day's TV Guide--->
<cfquery name="getguide" datasource="#dsource#">
	SELECT *
	FROM tbl_guide
	WHERE guide_DT = '#DateFormat(thisday, "DD MMM YY")#'
</cfquery>

<title>#title# for #DateFormat(Now(), "DD MMM YY")#</title>
<body>
<h2>#title#</h2>
<h3>#DateFormat(Now(), "DD MMM YY")#</h3>
<cfif getguide.recordcount GT 0>
<table width="300" border="1" class="header"><tr bgcolor="white"><td width="15%" align="center"><a title="View the Previous day" href="default.cfm?thisday=#dateformat(lastday,"mm/dd/yyyy")#"><font><<</font></a></td><td width="70%" align="center">#dateformat(thisday,"mm/dd/yyyy")#</td><td width="15%" align="center"><a title="View the Next day" href="default.cfm?thisday=#dateformat(nextday,"mm/dd/yyyy")#"><font>>></font></a></td></tr>
	<TR class="header">
		<TD>CHANNEL</TD>
		<TD>HOURS</TD>
		<TD>PROGRAM</TD>
	</TR>
<cfloop query="getguide">
	<TR class="guide-sub">
		<!---<TD>&nbsp;</TD>--->
		<TD>#getguide.guide_ch#</TD>
		<TD>#getguide.guide_time#</TD>
		<TD>#getguide.guide_tx#</TD>
	</TR>
</cfloop>
<cfelse>
<p class="warnl">Currently there is no TV Guide listing.</p>
</cfif>
</table>

</body>
</html>
</cfoutput>

rojas1mg - - - I love Tek-Tips and all members who reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top