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

  • SEARCH
  • Home
  • 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 693675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:46:41+00:00 2026-05-14T02:46:41+00:00

I will try to be as clear as possible because I can’t get anybody

  • 0

I will try to be as clear as possible because I can’t get anybody to help me around,

I am trying to associate some data from a ‘videos’ table with their respective ID.

Lets say, I have column ID, title, serie, season, episode.

I am getting my data :

    <?
$result = mysql_query("SELECT * FROM videos WHERE serie = '".$row['serie']."' AND season = '".$row['season']."'");
$total_rows = mysql_num_rows($result);
       ?>

(that is in the page where you see the video itself)

So now I can get the number of episodes from a serie and season.

What I’m trying to do is have a link for the next episode, and aa link for the previous one. In the URL I am working with the id, so http://website.com/view/id/‘video id here’/

So how can I get the ID of the following and previous episodes of the same season AND serie?

Help will be much appreciated!

The easiest thing I thought of is

<?=$row['id'] + 1?>
<?=$row['id'] - 1?>

But the thing is that it’s mixed videos, so it wont work 100%

  • 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-14T02:46:42+00:00Added an answer on May 14, 2026 at 2:46 am

    I think you’ve taken my example too literally. I’ll post a complete example in the morning (I’m just replying from my iPhone at the mo). For some reason it wouldn’t let me add a comment to your last reply, so sorry this is as an answer.

    [edit] here’s a more complete example:

    <?php
    
    $result = mysql_query("SELECT * FROM videos WHERE series='$series' AND season = '$season'");
    
    $last_row = null;
    $next_row = null;
    
    $current_id = $_GET['id'];
    
    while($row = mysql_fetch_assoc($result)) {
        if($current_id == $row['id']) {
            $next_row = mysql_fetch_assoc($result);
            break;
        }
    
        $last_row = $row;
    }
    
    if($last_row != null) {
        echo "<a href='?id={$last_row['id']}'>Prev</><br/>\n";
    }
    
    if($next_row != null) {
        echo "<a href='?id={$next_row['id']}'>Next</><br/>\n";
    }
    
    ?>
    

    A few things to note:

    • This is untested.
    • In your initial example, I didn’t know where you were getting the $row[‘serie’] and $row[‘season’], so in my example, I’ve just used the variables $series and $season. You’ll have to fill these in with what you want the current result set to be filtered by.
    • For my example, the URL format uses the GET layout (ie. ?id=).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Been a tough week, will try to make this as clear as possible. Appreciate
I will try to make myself as clear as possible. Let start from the
Let me try and be as much clear as possible although it won't be
I think this may not be possible, will try and explain as best as
Ok I will try to explain this as much as possible. I have a
I am working on an algorithm that will try to pick out, given an
I'm fairly new to C# but I will try to make this quick! ;)
This might be a little hard to explain, but I will try. I want
I'm try to develop a regex that will be used in a C# program..
I am about to try and automate a daily build, which will involve database

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.