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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:46:15+00:00 2026-05-23T10:46:15+00:00

I have my paging script that gets the page variable and puts in in

  • 0

I have my paging script that gets the page variable and puts in in LIMIT values inside a sql query.

LIMIT $page, $limit2 

it all works well,the problem is that i have 2 sql queries so LIMIT 0,10 displays 10 results from first query and then 10 more from second query =20 results per page,what i need is to display 10 from 1st QRY and on 2nd page the rest from first QRY and only then to print the results from 2nd query.

I tried if statement before whole query an a ++increment inside while loop to even the numbers with found results and then run 2nd QRY but it seems that it doesn’t work that way.

also tried something like this with few matematical operations but it also doesn’t do much good.

    if($page==$printf2)
    {$limit2=10;} 
    if($page==0)
    {$limit2=0;}

What would be the proper way of making the 2nd QRY list after 1st one ended,without more than 10 results per page?

  • 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-23T10:46:15+00:00Added an answer on May 23, 2026 at 10:46 am
    $sql = "QUERY1 LIMIT $page, $limit";
    $result = mysql_query($result);
    
    /* process the result here! */
    
    if (mysql_num_rows($result) < 10) {
        $sql2 = "QUERY2 LIMIT $page, $limit2";
        $result = mysql_query($result);
    
        /* process result of query 2 */
    }
    

    This way, the query two is executed only when the rows returned from query1 is the last set of rows in the table.

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

Sidebar

Related Questions

I have a paging repeater inside of an UpdatePanel so that I can show,
I'm trying to page a table, and while I have paging already working, it
I have a paging worked with NHibernate: public IEnumerable<Answer> GetAnswers(int page, int pageSize) {
I have a simple UserControl for database paging, that uses a controller to perform
I have an ASP.NET GridView with paging enabled. The list of page indexes are
I have been doing some customization to this jQuery paging script I found here
I have a page that uses jQuery tabs to tabify a set of HTML
Digital commercial products that customers pay for download link. I have put all the
I have a paging menu PartialView in my MVC app that looks like: <%
T-SQL Paging Sorting & Filtering I have been working on a T-SQL stored procedure

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.