onlyamir007
asked on
Cold Fusion Query Output Problem!
dear Experts,
i want my query after to records it should come in second TR you can see picture i attached how i want my query should show my records
i want my query after to records it should come in second TR you can see picture i attached how i want my query should show my records
<cfoutput query="getMoreRecords">
<cfif i EQ 3 or i EQ 1>
<tr>
</cfif>
<td width="43%" class="Inner_FooterLinks">
<a href="##">Namiba's Sink Hole</a>
</td>
<cfif i EQ 2 >
</tr>
<cfset i = 1 >
<cfelse>
<cfset i = ++i >
</cfif>
</cfoutput>
table-lookLike.jpg
Since every link is the same , I'm not sure I understand the desired results. But I'll take a guess ...
If you want to display the results in 3 columns, use MOD
If you want to display the results in 3 columns, use MOD
<table>
<tr>
<cfoutput query="getMoreRecords">
<td width="43%" class="Inner_FooterLinks">
<a href="##">#SomeColumn#</a>
</td>
<cfif currentRow mod 3 eq 0>
</tr><tr>
</cfif>
</cfoutput>
</tr>
</table>
ASKER
dear Aqx,
after applying ur code output coming something like this u can see attached pic and please have a look HTML OUT Putt
after applying ur code output coming something like this u can see attached pic and please have a look HTML OUT Putt
<table width="74%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td class="Inner_FooterLinks">
<a href="innerPage.cfm?contentid=18">Need For Speed</a>
</td>
<td class="Inner_FooterLinks">
<a href="innerPage.cfm?contentid=19">Ray Feeding</a>
</td>
<td class="Inner_FooterLinks">
<a href="innerPage.cfm?contentid=20">Off-Roading with AD4x4.com</a>
</td>
</tr><tr>
</tr>
<!-- -->
</table>
table-lookLike.jpg
ASKER
dear erikTsomik:
please have a look when im running ur code this is HTML OUTPUT please have look output picture aswell
please have a look when im running ur code this is HTML OUTPUT please have look output picture aswell
<table width="74%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="43%" class="Inner_FooterLinks">
<a href="#">Namiba's Sink Hole</a>
</td>
<td width="43%" class="Inner_FooterLinks">
<a href="#">Namiba's Sink Hole</a>
</td>
<td width="43%" class="Inner_FooterLinks">
<a href="#">Namiba's Sink Hole</a>
</td>
<!-- -->
</table>
table-lookLike.jpg
>> dear Aqx, after applying ur code output coming something like this u can see attached pic
@onlyamir007
Ok, I see the image. But I still don't understand your goal.
Can you explain how it's different from what you want? ie What is it doing wrong?
@onlyamir007
Ok, I see the image. But I still don't understand your goal.
Can you explain how it's different from what you want? ie What is it doing wrong?
All of the values in your original example are the same: "Namiba's Sink Hole". That makes it hard to understand what your'e trying to do.
Can you use different values like:
ie
... THEN show how you want the output to look
Example:
Can you use different values like:
ie
SomeColumn
===========
apple
orange
pear
grape
banana
kiwi
===========
apple
orange
pear
grape
banana
kiwi
... THEN show how you want the output to look
Example:
row 1 | apple | orange | pear |
row 2 | grape | banana | kiwi |
ASKER
Dear _agx_
what i want to do you can see HTML Code
-------------------------- ---------- ---------- ---------- ---------- ---------- ------
<table width="33%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="48%">Record 1</td>
<td width="52%">Record 4</td>
</tr>
<tr>
<td>Record 2</td>
<td>Record 5</td>
</tr>
</table>
what i want to do you can see HTML Code
--------------------------
<table width="33%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="48%">Record 1</td>
<td width="52%">Record 4</td>
</tr>
<tr>
<td>Record 2</td>
<td>Record 5</td>
</tr>
</table>
<table width="33%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="48%">Record 1</td>
<td width="52%">Record 4</td>
</tr>
<tr>
<td>Record 2</td>
<td>Record 5</td>
</tr>
</table>
maybe you can order the query such a way so you would not have to change the code
ASKER
<table width="33%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="48%">Row 1</td>
<td width="52%">Row 3</td>
</tr>
<tr>
<td>Row 2</td>
<td>Row 4</td>
</tr>
</table>
ASKER
this is not the case of ordering the query this is just how can i show my records in 2nd col after 2nd row u can see HTML how i want to show my records
you can do it this way. Usea queryNew to create a static query in the needed order and then simply output
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ohh dear thank you very much it is working fine but only one problem when records are exceeding 4 it should come other Colum for example
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Record 1</td>
<td>Record 3</td>
<td>Record 5</td>
</tr>
<tr>
<td>Record 2</td>
<td>Record 4</td>
<td>Record 6</td>
</tr>
</table>
ASKER
Thanks
@onlyamir007 -
You keep changing the requirements. First it was 3 columns, then 2 (down and across) . Now it's seems like something very different. Which is it? ;-)
You keep changing the requirements. First it was 3 columns, then 2 (down and across) . Now it's seems like something very different. Which is it? ;-)
<cfset i = 0>
<cfoutput query="getMoreRecords">
<cfset i++>
<cfif i EQ 4 or i EQ 1>
<tr>
</cfif>
<td width="43%" class="Inner_FooterLinks">
<a href="##">Namiba's Sink Hole</a>
</td>
<cfif i eq 4>
</tr>
</cfif>
</cfoutput>