offset of specific row between selected rows
i'm writnig a very small forum for my website .. i really didn't want to
use vb and other forum systems .
so
topics ( title , id )
posts ( text , id , topic_id )
there is a page that shows all the entry(posts) of given user
in this page for each user post , i show name of the topic and a short
summary of that post
here is the problem
when i click on the topic name .. i don't want to go to the first page of
topic . i want the exact page that contains that specific post .
so i gont the post id (lets say 666 ) i can get the topic information
using that (lets say title : topic A )
so i can get total count of the posts in topic A
lets say
$total_posts_intopic = 250 ;
$per_page = 15 ;
all i need now is the offset of post #666 to figure out the page number
so how can i get the offset of post #666 between topic A posts ?
or is there any easier way to do this ?
note : post no 666 means it's 666 post overall in all of the topics not in
topic A
No comments:
Post a Comment