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 8783441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:49:53+00:00 2026-06-13T20:49:53+00:00

This is more of a general programming question as opposed to a PHP question,

  • 0

This is more of a general programming question as opposed to a PHP question, however the PHP language is the one I am using current.

I will show you a dilemma which I am having and I not found a solution as of yet; will be interesting to see the answer.

Full file (only short, jQuery is loading this in):

<?php
    require_once('../../../wp-blog-header.php');
    header('HTTP/1.1 200 OK');
?>
<br /><br /><br /><br /><br /><img id="quoteOne" src="http://www.1.co.uk/wp-content/themes/1/images/quote1.png">
    <span><?php
        query_posts(array(
            'cat' => 39,
            'order' => 'ASC', // ASC
            'orderby' => 'rand',
            'showposts' => 1,
            ));
        $wp_query->is_archive = true; $wp_query->is_home = false;
        if (have_posts()) : while (have_posts()) : the_post();
        the_content();
        //the_id();
        endwhile; endif;
        session_start();
        $_SESSION['i'] = the_id();
        $prev = $_SESSION['i'];
        //echo $_SESSION['i'];
        //$_SESSION['i']++;
    ?>
    <a href="#" style="color: #86a53e;" id="nextQu">NEXT QUOTE</span>
    </span>

PHP (code in question):

// the_id() returns current id of post
session_start();
$_SESSION['i'] = the_id();
$prev = $_SESSION['i'];

The objective of this snippet is to check that the current id does not equal the previous id (to prevent duplicates showing and looking like nothing is happening). I need to be able to perform something like;

if($previous == $current){
    // try again
}

I cannot find a way to store it without it being reset every time. Is there a way of programming to do this?

This file is loaded via: (a separate file)

$('#testimonialContent').load('http://www.1.co.uk/wp-content/themes/1/testimonialPull.php');
  • 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-06-13T20:49:54+00:00Added an answer on June 13, 2026 at 8:49 pm

    Not 100% sure what you’re asking, but is this what you want?

    session_start();
    $prev = isset($_SESSION['i']) ? $_SESSION['i'] : null;
    $_SESSION['i'] = the_id();
    
    if ($prev == $_SESSION['i'])
    {
        // whatever
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is more of a maths/general programming question, but I am programming with PHP
This is more a general purpose programming question than language specific. I've seen several
this may be a more general opengl question. using OpenGL ES for 2d, and
Although I'm coding in Objective C, this is more of a general programming question.
This is more of a general programming question so the code examples I give
This is a general programming question, not pertaining to any specific language. A new
Although I'm programming in C++, this is more of a general question about design.
This is more a general question but my particular case involves a ruby/rails app
I suppose this question is more general than working with COM components. I have
This is more of a general design question I guess... I have an Ajax

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.