<cfquery datasource="yyyyyy" name="getData1" > 
SELECT Category FROM Products WHERE Product_ID=#displayImg2#
</cfquery>
<cfset PosInCatOfImg= > // how learn position of this Product_ID in getData1 query result data of Products ?

eg is the 13th row ???

Recommended Answers

All 6 Replies

The query is already filtered by a Product_ID. So it's not clear what value are you referring to.

If you could explain why you need to determine the row number, and what db you're using we may be able to suggest a better option.

I use MySQL, I want the position eg 7th row, of the only one returned row, in the resultset...?

I want the position eg 7th row, of the only one returned row,

It's still not making sense.

How can there be 7 rows in a query that only returns 1 row? Why do you need to know the row position? ie What are you using it for

use to appear if needed: back/fwd Photo arrows/links (for go to next/previous Photo only in particular cat photos) in a individual photo page, Products table include Photos from all cat so, I need position in resultset NOT to appear if first/last record the left go / right go arrows...

If you're trying to do pagination (be it 1 item per page or 10), this seems like the wrong approach ie too complicated. Do a search on +ColdFusion +pagination. There's plenty of working examples.

check easycfm.com for a good example. There's a lot of tutorials in there for a lot of different stuff too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.