I have a pagination comment system, 10 per page. I want to make comments on the comments. I would like the script to find out which page the comment is on, without specifying the page number and without excessively large requests or processing. So, for example, the link to the comment on page 5 will open the browser on the comment page 5 and #, scroll to the comment (as opposed to showing comments on its own page).
I was thinking of using 2 mysql queries, one SELECT all CommentId and then php array_searchto find the position in the result, and from this I could calculate which page it will be on. The second request will receive the required comment page. This seems rather ineffective, although especially if there are a lot of comments to pull out.
Can anyone suggest a simpler or more efficient way?
source
share