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

eg is the 13th row ???

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

6 Years
Discussion Span
Last Post by jsmall26

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.