This is how to get the rows based on the row number:
SET @rownum = 0;
Select sub.*, sub.rank as Rank
FROM
(
Select *, (@rownum:=@rownum+1) as rowNum
FROM Categories
) sub
WHERE rowNum IN (4, 6)
However, Mysql has a built in function ORDER BY LIMIT
to do this.
1
solved How to print row of choice mysql in php [closed]