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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:39:07+00:00 2026-05-25T17:39:07+00:00

I am making a page where people can make posts. All of those posts

  • 0

I am making a page where people can make posts. All of those posts are then shown in a table of 24 cells. I can have the last 24 posts shown with no problem, but now I don’t know how to show the prior group(s) of posts. How can I fix my code to do that? I actually have this:

(I’m removing lines to make it easy to read)

$sql = "SELECT
    topics.topic_id,
    topics.topic_subject
ORDER BY
    topics.topic_id DESC";

//   ---check everything is fine----   //

function retrieve_info($result)
{
 if($row = mysql_fetch_assoc($result))
     {echo $topic_if; echo $topic_subject; //and what I want in every cell
     }
}

<table width="100%" height="751" >
<tr><td><?php retrieve_info($result);?></td>
    <td><?php retrieve_info($result);?></td>
    <td><?php retrieve_info($result);?></td>
    <td><?php retrieve_info($result);?></td></tr>
<!-- repeat a few more times :-) -->
</table>

I though that by changing the variable $row with a number before the if statement would alter the output, but I still see the same data printed on screen. What should I do to be able to show next group of posts?
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-25T17:39:07+00:00Added an answer on May 25, 2026 at 5:39 pm

    At some point when you have hundreds or thousands of records, you are going to want to paginate the results and not just select all records from the table.

    To do this you will run one query per 24 records, your sql would be more like this:

    $sql = "SELECT
        topics.topic_id,
        topics.topic_subject
    ORDER BY
        topics.topic_id DESC
        LIMIT 0, 24
    ";
    

    and for the next 24,

    LIMIT 24, 24
    

    then

    LIMIT 48, 24
    

    and so on.

    You would then make next/previous buttons to click which would refresh the page and dispay the next 24, or you would get the next results with an AJAX request and append the next 24 through the DOM.

    This suggests having to take a slightly different approach then calling the same function from each table cell.

    More like get the relevant 24 results based on the page number you are on, then loop through the results array and print out the table code with values inside it. Based on if the iterator of the loop is divisible by 4 (looks like your grid is 4×6), you print out new tags for the new row, and that sort of thing.

    Search around a bit for pagination in php and mysql to get a sense of how this all fits together.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written a timecard app, and I have a page where people can punch
Please have a look at this page www.pixeli.ca/issue. I have begun making a page
I have a page which has three components: suggested items, suggested people, and a
So, I'm making a website similar to FML and others, where people can post
I have a website where people can contact each other, and quite often people
I have never understood why some people say making custom css for each browser
I have researched this problem but it is mostly from people who want to
I'm making a page which has some interaction provided by javascript. Just as an
I'm making a page where the user upload a file. I want an if
hello I am making web page searching program with windows batch file before searching

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.