Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6951807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:16:04+00:00 2026-05-27T14:16:04+00:00

Let me explain what I am trying to do. First, here is a preview

  • 0

Let me explain what I am trying to do. First, here is a preview of my results so far:

enter image description here

My Query:

SELECT slides.name as slide, filename, time, sort_id 
FROM `slide_sort` 
INNER JOIN slides 
    ON slide_sort.slide_id = slides.id 
WHERE slide_sort.user_id = 1

So each slide is a page that is already created, but each user will be able to specify how long to stay on that page and what the next “slide” will be.

So the HTML looks like this: (dashboard.php)

<meta http-equiv="refresh" content="40;url=did-you-know.php">

Right now it is hard coded in but I want to be able to pull it from the database.


So on the dashboard.php file I could have something at the top like: $currentSlide = "Dashboard"; and that way I could add to the query AND slide = $currentSlide so that way I could see that the time is 40 seconds for that slide, so I could stick that in to the content="$time". But my question is, how can I add another query to get the NEXT sort_id so sort_id + 1 and get that filename, so I would have the following information:

slide – time – next_filename

Dashboard – 40 – did-you-know.php


BUT I also need to see if it’s the last sort_id and if it is, then the next slide needs to start over at #1.

Does this make sense?

If anyone could help me get in the right direction I would really appreciate it.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:16:05+00:00Added an answer on May 27, 2026 at 2:16 pm

    You can retrieve the NEXT sort id with something like this:

    SELECT slides.name as slide, filename, time, sort_id  
    FROM `slide_sort` 
    INNER JOIN slides 
    ON slide_sort.slide_id = slides.id 
    WHERE slide_sort.user_id = 1 and slide_sort.sort_id = ($sort_id + 1)
    

    You can retrieve the LAST sort id with something like this:

    SELECT sort_id 
    FROM `slide_sort` 
    INNER JOIN slides 
    ON slide_sort.slide_id = slides.id 
    WHERE slide_sort.user_id = 1 order by sort_id desc limit 1
    

    You can check if the this is the last slide with something like this:

    if ($sort_id == $last_sort_id)
    

    If it is, you can retrieve the FIRST sort id record:

    SELECT slides.name as slide, filename, time, sort_id  
    FROM `slide_sort` 
    INNER JOIN slides 
    ON slide_sort.slide_id = slides.id 
    WHERE slide_sort.user_id = 1 order by sort_id ASC limit 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quite new to maven here so let me explain first what I am trying
Let me first explain what I'm trying to achieve using some pseudo-code (JavaScript). //
Let me first try to explain what I'm trying to achieve. I'm making a
First let me explain my goal. I am trying to make an Animation that
Ok so first let me explain what I am doing: I am trying to
Alright let me explain my situation first: I am part of an organization that
First let me explain how I currently handle validation, say, for an IPv4 address:
First, let me explain what I am doing. I need to take an order,
It might sound unnecessary, but let me explain my problem first. Probably then it
First I'm going to explain what I'm trying to do, before asking the question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.