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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:29:35+00:00 2026-06-14T12:29:35+00:00

It was some time ago I worked with PHP, MySQL and SQL, so I

  • 0

It was some time ago I worked with PHP, MySQL and SQL, so I need some help. In my table I have 44 rows, but I only want to get 24 of them. Before I have just loaded all the rows like in the code below, and now I need some help to modify it to only load 24 rows. Thanks!

$query = "SELECT * FROM {$tableObject} {$sort1};";

$res = $mysqli->query($query);

$row_cnt = mysqli_num_rows($res);

while($row01 = $res->fetch_object()) {
// Some other code here
}
  • 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-14T12:29:35+00:00Added an answer on June 14, 2026 at 12:29 pm

    Use this in your query:

    LIMIT 24
    

    LIMIT is a MySQL function that selects a particular range of results from your query results. There are basically two ways of using it:

    1. By simply specifying the number of results you want to fetch, like LIMIT 24; or
    2. By specifying another range in the form of LIMIT X, Y. Where X is the beginning and Y is number of rows you want to fetch, like: LIMIT 10,5 that would select the 5 results from row 11 to 15

    In your particular case you can simply replace this line:

    $query = "SELECT * FROM {$tableObject} {$sort1};";
    

    For:

    $query = "SELECT * FROM {$tableObject} {$sort1} LIMIT 24;";
    

    or even:

    $query = "SELECT * FROM {$tableObject} {$sort1} LIMIT 0,24;";
    

    For a better understanding about how to use limit, I recommend you to read this page from MySQL manual

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

Sidebar

Related Questions

I work with DbSimple in my site-engine. Everything worked fine but some time ago
I've worked with MySQL and MSSQL for some time and have used a variety
I have one problem and it is some time ago I have added a
I could've sworn this worked some time ago when my object was declared on
I get this while running the code which worked some time ago. i tried
I have used JRebel and Eclipse Juno for some time, but now it seems
i really need some help with this..i have done a lot of search and
I have a lot of unmanaged C++ code written quite some time ago. Now,
Some time ago I've read an article on CLR, where author showed that if
Some time ago I was asked the strange question how would I implement map

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.