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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:45:16+00:00 2026-05-24T13:45:16+00:00

I searched Google on how to do this, and I got the following link:

  • 0

I searched Google on how to do this, and I got the following link:
http://www.9lessons.info/2009/12/twitter-style-load-more-results-with.html

That is exactly what I want to do, however it’s rather confusing to me so I can’t work out how to implement it properly to my current file.

My current query is as follows.

if (!$query = @mysql_query("SELECT * FROM confessions ORDER BY date DESC LIMIT 10")) {
    echo '<strong>Error:</strong> '.mysql_error().'';
} else {
    echo '<div id="posts">';
    while ($q = mysql_fetch_array($query)) {
        $id = $q['id'];
        $name = $q['confession'];
        $date = date("j M Y", strtotime($q['date']));
        echo '<div class="confession" ';
        echo '>';
            echo '<table>';
                echo '<tr style="width:700px;">';
                    echo '<td style="width:100px;font-weight:lighter;font-style:italic;font-size:95%;">'.$date.'</td>';
                    echo '<td style="width:600px;">'.$name.'</td>';
                echo '</tr>';
            echo '</table>';
        echo '</div>';
    }
    echo '</div>';
}

Obviously that just grabs the data of the last 10 rows in that table, and as far as I know I just need some JavaScript to remember the limit, and how many it grabbed, so it can grab the next lot.

Is it possible somoene can give me a link to help me explain it more, or write up some code (from the link I gave) that’ll help?

  • 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-24T13:45:17+00:00Added an answer on May 24, 2026 at 1:45 pm

    Addressing Questions

    Obviously that just grabs the data of the last 10 rows in that table, and as far as I know I just need some JavaScript to remember the limit, and how many it grabbed, so it can grab the next lot.

    Right, your demo page does this with the Javascript variable ID, which they send to the ajax_more.php

    Is it possible somoene can give me a link to help me explain it more, or write up some code (from the link I gave) that’ll help?

    That is not necessary.


    Clarifying Demo

    The demo’s main page is loadmore.php, which creates the html page and coincidentally also lists the first batch from the query. It uses the button (the anchor link, not the link’s box) to store the most recent ID, in your case the button’s ID will be your date (Note: your date better be a unique field, or you may not return all results).

    When a user clicks the “more” link, the JavaScript gets its id and then passes that on to the ajax_more.php, which it uses in the query to get the next batch of results since the last query, based on the ID you sent it (the SQL order by is important).


    More

    1. As @hakre suggested, what you are referring to is called “paging” and most databases have their on implementation of it, such that you don’t need to re-query the database if you keep the connection open.
      Also in mySQL you can supply the length and the offset, so instead of storing the ID and using less than, you can store the amount of records already retrieved (referred to as an offset). Example:

      SELECT * FROM <your_table> LIMIT <offset>, <length>
      
      -- In Use:
      SELECT * FROM confessions LIMIT 40, 10
      -- 40 is the value that you passed to ajax_more.php via AJAX
      
    2. Warning: what the example doesn’t tell you is the security implications of how they’re querying the database. You’re exposing user input (through JavaScript) directly to the database, without scrubbing the data or using any special use of parameter passing. This is a big security hole and opens you put to SQL Injection attacks, which are basically holes that allow users to put their own SQL commands, that can gain access to your database, or even entire system.

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

Sidebar

Related Questions

I searched for this subject on Google and got some website about an experts
I searched on Google, and I got this code to check if a controller
I got this message when doing some javascript programming, and after some google searches,
I tried Google this issue and was searched over an hour on Stackoverflow, but
I've searched google and SO for a solution to this problem but have not
I have searched around Google and StackOverflow trying to find a solution to this,
I've searched a lot for this on google, but without luck... Basically I need
I've searched here and on google before asking this cause I see its a
I have searched this topic on google a bit and seen some best practices.
I have searched this site and Google and even though the idea is pretty

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.