| | |
dynamic td's not tr's
Please support our ColdFusion advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2005
Posts: 1
Reputation:
Solved Threads: 0
i have a table with data that i am trying to display with 4 td's and then create a new row. i will eventually set the row limit, but for now this is what i have:
<cfquery name="get_stuff" datasource="#dsn#">
SELECT *
FROM item
WHERE item_type_id = 1
ORDER BY item_name
</cfquery>
<table cellpadding="12px" cellspacing="12px" border="0" align="center">
<tr>
<td class="td_jewl" valign="top" colspan="4">Click on any picture to see a larger view.</td>
</tr>
<tr>
<cfset cellcount=0>
<cfoutput query="get_stuff">
<cfif cellcount NEQ 4>
<cfset cellcount = cellcount + 1>
<td class="td_jewl" valign="top">
<cfelse>
</tr>
<tr>
<td class="td_jewl" valign="top">
<cfset cellcount=1>
</cfif>
<cfoutput>
<img src="../jpg/cabochon/#item_imx#" alt="" border="0"><br>
#item_name#<br>
#item_description#
</cfoutput>
</td>
</cfoutput>
</tr>
</table>
but...it isn't quite working. i have only 5 items in the db right now. the first row is writing to the page correctly, but it starts repeating rather oddly after that...like this (numbered to make it easy to see what is happening):
1 2 3 4
2 3 4 5
3 4 5
4 5
5
Any help in solving this would be greatly appreciated!
<cfquery name="get_stuff" datasource="#dsn#">
SELECT *
FROM item
WHERE item_type_id = 1
ORDER BY item_name
</cfquery>
<table cellpadding="12px" cellspacing="12px" border="0" align="center">
<tr>
<td class="td_jewl" valign="top" colspan="4">Click on any picture to see a larger view.</td>
</tr>
<tr>
<cfset cellcount=0>
<cfoutput query="get_stuff">
<cfif cellcount NEQ 4>
<cfset cellcount = cellcount + 1>
<td class="td_jewl" valign="top">
<cfelse>
</tr>
<tr>
<td class="td_jewl" valign="top">
<cfset cellcount=1>
</cfif>
<cfoutput>
<img src="../jpg/cabochon/#item_imx#" alt="" border="0"><br>
#item_name#<br>
#item_description#
</cfoutput>
</td>
</cfoutput>
</tr>
</table>
but...it isn't quite working. i have only 5 items in the db right now. the first row is writing to the page correctly, but it starts repeating rather oddly after that...like this (numbered to make it easy to see what is happening):
1 2 3 4
2 3 4 5
3 4 5
4 5
5
Any help in solving this would be greatly appreciated!
•
•
Join Date: Oct 2005
Posts: 8
Reputation:
Solved Threads: 1
ok - if i'm hearing you right:
First thing is to request the actual cols you want - good practice in case the schema changes in the future.
Next - I can't see where you are getting the value '1' from (WHERE item_type_id = 1) - is this dynamic or are you hardcoding this??
What is the datatype for column 'item_type'?
Let me know these answers and i should be able to help..
:eek:
Jam
First thing is to request the actual cols you want - good practice in case the schema changes in the future.
Next - I can't see where you are getting the value '1' from (WHERE item_type_id = 1) - is this dynamic or are you hardcoding this??
What is the datatype for column 'item_type'?
Let me know these answers and i should be able to help..
:eek:
Jam
•
•
Join Date: Jun 2005
Posts: 15
Reputation:
Solved Threads: 1
•
•
•
•
Originally Posted by bugsferg
i have a table with data that i am trying to display with 4 td's and then create a new row. i will eventually set the row limit, but for now this is what i have:
<cfquery name="get_stuff" datasource="#dsn#">
SELECT *
FROM item
WHERE item_type_id = 1
ORDER BY item_name
</cfquery>
<table cellpadding="12px" cellspacing="12px" border="0" align="center">
<tr>
<td class="td_jewl" valign="top" colspan="4">Click on any picture to see a larger view.</td>
</tr>
<tr>
<cfset cellcount=0>
<cfoutput query="get_stuff">
<cfif cellcount NEQ 4>
<cfset cellcount = cellcount + 1>
<td class="td_jewl" valign="top">
<cfelse>
</tr>
<tr>
<td class="td_jewl" valign="top">
<cfset cellcount=1>
</cfif>
<cfoutput>
<img src="../jpg/cabochon/#item_imx#" alt="" border="0"><br>
#item_name#<br>
#item_description#
</cfoutput>
</td>
</cfoutput>
</tr>
</table>
but...it isn't quite working. i have only 5 items in the db right now. the first row is writing to the page correctly, but it starts repeating rather oddly after that...like this (numbered to make it easy to see what is happening):
1 2 3 4
2 3 4 5
3 4 5
4 5
5
Any help in solving this would be greatly appreciated!
Try the MOD command, on for size.
![]() |
Similar Threads
- Dynamic pull out menus (JavaScript / DHTML / AJAX)
- Creating dynamic array structures (C++)
- Dynamic web pages? Which will exist? (IT Professionals' Lounge)
- dynamic IP's and Websites (Domains and DNS)
- Core PHP Programming to Build Dynamic Websites (PHP)
- Dynamic Drive Overlay Win98 80 gig support (Windows 95 / 98 / Me)
Other Threads in the ColdFusion Forum
- Previous Thread: Java Virtual Machine Problem
- Next Thread: update oracle column but bot replace
| Thread Tools | Search this Thread |





