Answer the question
In order to leave comments, you need to log in
How to get both an array of goods and quantity?
Good afternoon. It is necessary to display the products on the page, as well as under them the total number of products found (the condition changes). Products are displayed 30 per page.
You have to make two requests. The first outputs the array of goods itself, limiting it with LIMIT. The second count(*) with the same conditions as the first request. I heard that PDO can somehow work without LIMIT. Does it make sense to redo it (if it is of course possible) or am I right and so I deduce?
Answer the question
In order to leave comments, you need to log in
PDO does not write SQL for you. It can only fulfill the request that you yourself were able to write. Therefore, the phrase "PDO can somehow work without LIMIT" does not make sense.
So leave requests as they are.
It always makes sense to remake it under PDO if you now have a standard shit code like "Peter has 2 apples, and Vasya has 5": while mysql_fetch_array and that's it.
If SQL_CALC_FOUND_ROWS will be pushed to you - don't get fooled, it is certainly slower than count (*) and still 2 queries.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question