How do I get multiple hyperlinks to diplay in a query output?
i using 2 tables list of sport teams school. sports table lists of team data grouped gender. second table uses sportid first table associate team schedule. problem not teams have schedule yet.
trying display link teams schedules. compare 2 tables, sports & schedule , use cfif statement compare 2 sportids in output determine teams have schedule. if 2 sportids match hyperlink displayed.
unfortuanetely, 1 link displayed, though there should 3 links. below code:
table display teams grouped gender
<cfquery name="getsports" datasource="#application.database#">
select gender, team, levels, sportid
from sports
group gender, team, levels, sportid
</cfquery>
table used sportid schedules created
<cfquery name="getid" datasource="#application.database#">
select sportid
from schedules
group by sportid
</cfquery>
i compare sportids , if match, display hyperlink
<cfoutput query="getsports" group="gender">
<h1">#gender#'s teams</h1>
<ul>
<cfoutput>
<li>
<cfif getid.sportid eq getsports.sportid><a href="teams.cfm?sportid=#sportid#"></cfif>
#team# <cfif levels gt "">(#levels#)</cfif> //levels used differentiate between j.v. , varsity. not teams use levels
<cfif getid.sportid eq getsports.sportid></a></cfif>
</li>
</cfoutput>
</ul>
</cfoutput>
how other teams display links?
only 1 link being displayed because comparing against first record returned "getid" query. in if statement <cfif getid.sportid eq getsports.sportid> "getid.sportid" same using "getid[1].sportid". returns first record.
you looping on "getsports" query need compare sportid's each record returned "getid" query. there several ways can that. enough going or need examples?
More discussions in ColdFusion
adobe
Comments
Post a Comment