Jump to content

Recommended Posts

I am still learning PHP and am a bit stuck.

 

I'm working on a site which has several hundred articles stored in a MySQL database. On the bottom of the page are two links for the previous and next article. The site has been constructed in such a way that the database has fields containing the url of the previous and next pages (i.e. article.php?recordID=137) and these are pulled out of the DB in the form of links. Rather than them having to add this to the DB every time a new article is added I'm trying to automagically do it in PHP. I've sorted the main part by taking the current article and either subtracting or adding it's ID by 1 to create the prev and next but I'm a bit stuck when it comes to the current (highest) article number. What I want it to do is link to an index page when there is no +1 (or -1 for the start).

 

Can anyone help

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/53327-solved-php-and-mysql/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.