Problems with php Paging

Asked

Viewed 28 times

0

I just discovered the flaw. The url was the answer!

My code was sending the address as follows: localhost/ports/searches.php? page=2&selector=requested

What really showed the number buttons was this: localhost/ports/searches.php? page=2&type=situacao&selector=request&filter=

So I only had to modify the last line that refers to the numbering to the equivalent as follows:

localhost/ports/searches.php? page=1&type=$situacao&selector=$selector=$selector=$filter

In the php script:

//PAGINAÇAO
//Verificar a pagina anterior e posterior
$pagina_anterior = $pagina - 1;
$pagina_posterior = $pagina + 1;
print "<div class='container'>
<div>
                <ul class='pagination'>
                    <li>";
if($pagina_anterior != 0){
    print "<a href='pesquisas.php?pagina=$pagina_anterior&tipo=$tipo&seletor=$seletor&filtro=$filtro' aria-label='Previous'>
                                <span aria-hidden='true'>&laquo;</span>
                            </a>";
}
else{
    print "<span aria-hidden='true'>&laquo;</span>";
}
print "</li>";
//Apresentar a paginacao
for($i = 1; $i < $num_pagina + 1; $i++){
    print"<li><a href='pesquisas.php?pagina=$i&tipo=$tipo&seletor=$seletor&filtro=$filtro'>$i</a></li>";
}
print "<li>";
if($pagina_posterior <= $num_pagina){
    print " <a href='pesquisas.php?pagina=$pagina_posterior&tipo=$tipo&seletor=$seletor&filtro=$filtro' aria-label='Previous'>
            <span aria-hidden='true''>&raquo;</span>
        </a>";
}else{
    print "<span aria-hidden='true'>&raquo;</span>";
}
print "</div></div>";
//FIM PAGINAÇAO

Here’s a tip for anyone who has the same difficulty I had.

  • Just to confirm, none of your paging buttons work?

  • 1

    Oops, thanks for the friendly question. I just unraveled the mystery.

  • Just confirm if it was the lack of concatenation of the url of the pagination? haha

  • It was more lack of attention anyway. kkkkkkkkkkkk

  • kkkk right, success buddy, anything we are here!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.