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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:39:44+00:00 2026-05-22T00:39:44+00:00

Hi people as a new web programming im having a scenario and i need

  • 0

Hi people as a new web programming im having a scenario and i need some help.

Im trying to have a ‘next’ button on the page which will pull the next question from the database in a iterative manner. im passing php values straight to the button as text.

Currently I can grab the mysql resultset and print them all or i can grab just the one row and return its fields but what is the strategy to grab one with the next button, then another, and so on.

$result = mysql_query("SELECT * FROM $DB_QUEST_NAME ORDER BY pk_Id DESC;") or die(mysql_error());

    while ($row = mysql_fetch_array($result)){

    echo $pk_id = $row[0] . "<br>";
    echo $question = $row[1].  "<br>";
    echo $answera = $row[2]  .  "<br>";
    echo $answerb = $row[3] . "<br>";
    echo $answerc = $row[4] . "<br>";
    echo $answerd = $row[5] . "<br><br>";

    break;  
    }

In the mark up include the getNextPoll.php (above) which initial grabs the first result to displays them as button. but with every subsequent click I want to get the next, then the next and so on. I know how to set the button texts and Im also aware of server side client side responsibilites but as Im quite new to this type of development the methodology behind it a lil tricky.

Any feedback would be appreciated. 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-22T00:39:45+00:00Added an answer on May 22, 2026 at 12:39 am

    I believe you’re looking for MySQL’s “offset”. This allows you to run a query like ... limit 1 offset 0 to return the first result, then ... limit 1 offset 1 to return the 2nd result…and so on.

    (You don’t really need “offset 0”, since that’s the default anyway, but – just trying to illustrate the point.)

    EDIT:

    If you store the page variable in the URL like this: www.myPage.com/questions.php?pg=2

    Then you can do this:

    $numPerPage = 1;
    $pg = $_GET['pg'];
    $nxtPage = $pg++;
    $offset = ($numPerPage * $pg) - 1;
    $question = mysql_query("SELECT * FROM questions LIMIT " . $numPerPage . 
    " OFFSET " . $offset);
    

    Then, you’re “next” link could be:

    <a href="questions.php?pg=<?=$nxtPage?>">NEXT</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey people I'm new at jquery and i have been trying to figure this
We're starting new web site development with Umbraco, and having some difficulties with optimal
Many Flex books seem to focus on people new to programming. E.g. I bought
In my new job more people are using Python than Perl, and I have
I am new to iphone programming. I heard from few people that even if
I've created some new fields for users who register in admin/config/people/profile since we are
I am fairly new to ASP.NET and I discovered repeaters recently. Some people use
I have created a new SharePoint 2007 MOSS Intranet. Our admin people are purchasing
I'm pretty new to web programming and I'm currently developing a web back end
I am quite new to web development and have a task to develop a

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.