OK, here is the situation. I have about 5000 links to various sites and articles on my database each with a short description. They are displayed 5 at a time on the page by using the pagespan functions mentioned on the article section of this site. I modified it a bit but it works the same by showing Next -> Prev <= and current page as well as the two page numbers on either side of it. So if you are on page 40, you'll see
<= Prev .. 38 39 40 41 42 .. Next => with 40 not being highlighted or linked. It is using the URL to send variables on it like page=40.
OK, here is the problem. I want to add a search function to this so users can easily find what they would want, but I want the behaviour for it to act a bit differently than most search engines. I want it to show the Title of the article or link, then a link back to THAT PAGE on the site. I know this is a harder way to do it and inefficient, but I wanted to see if it could be done.
So, when a user clicks on the link, it will send him to http://<mydomain>/links.php?page=40#196 where page is where the page is located by using the page_span function and the 196 is the message ID of the article on the db.
So here is the ruffle. I have the messageID. I have the maximum number of articles per page. How can I find out which page it is located on so I can tag it onto the url along with the ID?
The normal query I would probably perform would be like this:
$query="SELECT ArticleID FROM articles ORDER BY Date";
Is there query where I can feed the database the messageid of a message, then it spit out the index it would have if it was ordered like that? A lot of my articles have been deleted by the users who posted them and the index does not add to the total number currently on the database.
I would hate to resort to for loop and checking ArticleIDs while retrieving each row one at a time. Any help will be appreciated. Thanks.