1 Replies - 2389 Views - Last Post: 04 January 2009 - 07:36 AM Rate Topic: -----

#1 cumupkid   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 63
  • Joined: 22-January 08

How do I use cfif to show row in table

Posted 03 January 2009 - 02:02 PM

I am trying to use cfif to show a row of a table, only if a certin variable is present. the row I want to do this to the first <tr> tag.

<cfparam name="URL.ITEMCATAGORY" default="appetizers">
<cfquery name="qMenu" datasource="#application.datasource#">
SELECT *
FROM items
WHERE ITEMCATAGORY = <cfqueryparam value="#URL.ITEMCATAGORY#" cfsqltype="cf_sql_clob" maxlength="50">
ORDER BY ITEMCATAGORY ASC 
</cfquery>

<div id="menucatagory"><cfoutput>#qMenu.itemcatagory#</cfoutput></div>
<table id="menuTable" align="center">
<tr>
		<td> </td>
		<td>Personal</td>
		<td>Small</td>
		<td>Medium</td>
		<td>Large</td>
		<td>Extra Large</td>
		<td>Sheet</td>
	</tr>
<cfoutput query="qMenu">
	<tr>
		<td>#qMenu.itemname#</td>
		<td>#qMenu.itemprice6#</td>
		<td>#qMenu.itemprice5#</td>
		<td>#qMenu.itemprice4#</td>
		<td>#qMenu.itemprice3#</td>
		<td>#qMenu.itemprice2#</td>
		<td>#qMenu.itemprice1#</td>
	</tr>
	<tr>
		<td colspan="8">#qMenu.itemdescription#</td>
	</tr>
</cfoutput>
</table>



Is This A Good Question/Topic? 0
  • +

Replies To: How do I use cfif to show row in table

#2 CR250   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 58
  • Joined: 14-June 08

Re: How do I use cfif to show row in table

Posted 04 January 2009 - 07:36 AM

Just use <cfif inside the <cfoutput

 
<cfoutput query="qMenu">
	<cfif qMenu.itemName eq "xyz">
	  <tr>
		<td>#qMenu.itemname#</td>
		<td>#qMenu.itemprice6#</td>
		<td>#qMenu.itemprice5#</td>
		<td>#qMenu.itemprice4#</td>
		<td>#qMenu.itemprice3#</td>
		<td>#qMenu.itemprice2#</td>
		<td>#qMenu.itemprice1#</td>
	  </tr>
	</cfif>
	<tr>
		<td colspan="8">#qMenu.itemdescription#</td>
	</tr>
</cfoutput>



Was This Post Helpful? 0
  • +
  • -

Page 1 of 1