Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
queryname.fieldname[rownumber]
Copy link to clipboard
Copied
care to elaborate ?
do you mean
<cfquery name="getData" datasource="foo">
SELECT firstname,surname,age
FROM pricelist
</cfquery>
<cfoutput>
getData.surname(1)
<cfoutput>
Copy link to clipboard
Copied
You have the general idea. For the details you need octothorps around your variable, and square brackets around your row number.
Copy link to clipboard
Copied
In my opinion you also "need" error handling for when three rows are not returned, etc. etc.
Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
What's happening that you don't like?
Copy link to clipboard
Copied
well for a start, it's outputting 27 items of data instead of 3
Copy link to clipboard
Copied
I thought it would only output 9. Take the query attribute out of your cfoutput tag.