Giter Site home page Giter Site logo

New comand Limit about php-crud-api HOT 8 CLOSED

mevdschee avatar mevdschee commented on May 7, 2024
New comand Limit

from php-crud-api.

Comments (8)

mevdschee avatar mevdschee commented on May 7, 2024 1

If you want the oldest records you need to sort in descending order. It you want to present these in your front end in ascending order then you should reverse the array after receiving it. Does that help?

from php-crud-api.

mevdschee avatar mevdschee commented on May 7, 2024

yes.. this is done using a combination of the "page" and "order" parameter (you must use both):

GET http://localhost/api.php/shopping_cart_products?order=id,desc&page=1,10

Like that, is that clear?

from php-crud-api.

Radigar avatar Radigar commented on May 7, 2024

Yes this combination it's ok for limit the query in order descending but if you want order by date and order ascending for example:

GET http://localhost/api.php/shopping_cart_products?order=created,asc&page=1,20

This call return the 20 oldest products but no the last 20 products ordered by date, or I'm wrong with this?

Thanks for your help @mevdschee

from php-crud-api.

Radigar avatar Radigar commented on May 7, 2024

Oh ok it's true, i can reverse the array this way. I thought that the API could bring me this already ordered.

Thank for your help!

from php-crud-api.

mevdschee avatar mevdschee commented on May 7, 2024

It does not because it is not included in SQL and the API is streaming the data, not keeping it in memory for reordering before sending it out. Kind regards, Maurits

from php-crud-api.

bhavesh-vyas avatar bhavesh-vyas commented on May 7, 2024

What! This api doesn't allow to get desc sorted with pagination?

You mean to achieve this we have to get all data without pagination and
then reverse it in local?

-Bhavesh
On Mar 16, 2016 10:13 PM, "Radigar" [email protected] wrote:

Oh ok it's true, i can reverse the array this way. I thought that the API
could bring me this already ordered.

Thank for your help!


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#41 (comment)

from php-crud-api.

mevdschee avatar mevdschee commented on May 7, 2024

No, that is not true. You can get the data with pagination, but have to reverse it local (if you want to present it in another order than the order that you have retrieved it in).

from php-crud-api.

mevdschee avatar mevdschee commented on May 7, 2024

Does this make things clear? Can I close this issue now?

from php-crud-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.