3
foreach ($result as $indices) {
// Aqui ele retorna 50 registros por conuslta
echo $indices['Empreendimento'];
// Provavelmente preciso de um loop da paginação aqui dentro
// para falar para o foreach que enquanto houver paginação, que
// ele continue buscando e listando os registros
}
I’m making a query on a server REST
which returns me 50 results at a time and pages the rest of the records probably to improve traffic management and not overload the server.
I want to return all the records on one page and I think I can do it using one for
or foreach
to tell the query that until you finish uploading all the records, you continue searching between the pages and listed the records, all in one page.
I think the solution is to read this pagination inside the foreach
with another loop but I don’t know how to apply. If you want to take a look at the page, HERE
Question: How to extract all data on a single page by traversing through the Trials and bringing the results?
The application does not allow me to pull more records so I need to use the second option which is to iterate under each page but do not know how to do it!!! Can you help me?
– Marcos Vinicius
You can already iterate on the first page, right?
– cantoni
Yes, the first page I have the first 50 records but I need all the records to appear on it and that’s what I can’t do.
– Marcos Vinicius
But this you will not be able to do at once. To solve, you will need to pass a parameter to your HTTP request. This parameter goes via POST and is called a page. Try a test by passing the page parameter with value 2 and see the result.
– cantoni
I’ve already done it. In the very image you posted there is this pagination. But I need all the results on one page just to take it all and register it in the database.
– Marcos Vinicius
@Marcosvinicius, you see. It is not possible to have all resutaldos in one page, because the application limits you. What you should do is loop according to the number of pages and, each iteration of this loop, you should make an HTTP request to the current page and feed your database. Therefore, if they are 3 pages, they are three loop iterations. The restriction is not in their application, it is in the application of the properties. You therefore need to suit yourself to this.
– cantoni
I don’t know how to do this iteration. You can help me?
– Marcos Vinicius