Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

php id

Featured Replies

Hi, I've recently developed a CMS from scratch using PHP and MySQL running through Apache/phpmyadmin on a localhost.Everything has gone very smoothly so far, visitors may view articles and navigate through the page successfully.

 

Admins (created by an Admin on the CMS or in the MySQL schema) can log in, view articles, edit articles, view and edit users and delete articles.

 

 

My problem is that when articles are deleted, a next/previous button at the bottom (of any existing articles) with a function of

 

 <?php if ($id != 1) : ?>

<a href="article.php?id=<?php echo $id - 1; ?>">Previous Article</a>

   

<?php endif; ?> 

 

which looks for a previously existing article with x-id, however since this article was deleted it no longer exists.

 

Is there any way to remove the article id as the article is deleted, thus freeing up that article id again? I can manually reset the id to 0,1,2,3... etc. in the schema on phpmyadmin, but I'd like to apply some logic in order to make this system work flawlessly.

 

Many thanks for you help, if I get time I'll upload the CMS to my web server so that it can be viewed freely.

 

~MYLZ

 

EDIT: a video can be viewed here:

 

http://youtu.be/F8LU1jei3E4

  • Author

It's all right - I figured it ^^

 

Did it by querying id:

 

SELECT * FROM articles WHERE id < ? ORDER BY id DESC LIMIT 1

SELECT * FROM articles WHERE id > ? ORDER BY id LIMIT 1

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.