Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

retrieve 3 rows of data and put each row in different position on screen

Participant ,
Feb 03, 2010 Feb 03, 2010

I need to retrieve 3 consecutive rows of data (easy) and need to put each row's data in an entirely different location on the home page

for example,

row 1 needs to go up in the top left content box

row 2 needs to go in the large content area in the middle of the page

row 3 needs to be put down in the footer of the page

what's the most efficient way to do this ?

TOPICS
Getting started
656
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 03, 2010 Feb 03, 2010

queryname.fieldname[rownumber]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 03, 2010 Feb 03, 2010

care to elaborate ?

do you mean

<cfquery name="getData" datasource="foo">

  SELECT firstname,surname,age

  FROM pricelist

</cfquery>

<cfoutput>

     getData.surname(1)

<cfoutput>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 03, 2010 Feb 03, 2010

You have the general idea.  For the details you need octothorps around your variable, and square brackets around your row number.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 04, 2010 Feb 04, 2010

In my opinion you also "need" error handling for when three rows are not returned, etc. etc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 15, 2010 Feb 15, 2010

Ok, I've tried to research this a bit more, but I'm no further forward

So if I have a query...

<cfquery name="getData" datasource="foo">

  SELECT *

  FROM 00_pricelist

</cfquery>

<cfoutput query="GetData" startrow=1 maxrows=3 >

     <!--- surrounding table 1 --->

     #getData.uneak_code[1]#<br />

     <!--- surrounding table 2 --->

     #getData.uneak_code[2]#<br />

     <!--- surrounding table 3 --->

     #getData.uneak_code[3]#<br />

</cfoutput>

can you tell me what I'm doing wrong ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 15, 2010 Feb 15, 2010

What's happening that you don't like?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 15, 2010 Feb 15, 2010

well for a start, it's outputting 27 items of data instead of 3

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 15, 2010 Feb 15, 2010
LATEST

I thought it would only output 9.  Take the query attribute out of your cfoutput tag.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources