6
Good is the following, I am generating pagination links to get more lightness in my system, the problem is I have many records in the database and this pagination generates many links, thus occupying a very large part of the page, I wonder if it is possible to limit the for in php so that it generates the links dynamically not taking up too much space on page, or if there is a smarter way to improve my code, thank you
the code I currently use is this
$qtdPag = gets the total record value divided by results per page
$pg = receives via GET the current page
if($qtdPag > 1 && $pg <= $qtdPag){
for($i = 1; $i <= $qtdPag; $i++){
if($i == $pg){
echo "<i>[".$i."]</i>";
} else {
echo "<i><a href='socios.php?pg=$i'>[".$i."]</a></i>";
}
}
You too can give one
LIMIT
in the query coming from the bank, this would limit the amount of records coming from the bank and consequently the pagination– MarceloBoni
the big problem is that using sql server, it does not accept the limit (alias this has brought me big problems)
– wwwjsw
Alias... why don’t you work with Jpaginate?
– MarceloBoni
well I am 'novice' let’s say so, I don’t want to use tools that facilitate the way before really learning the general logic
– wwwjsw
Look... regarding SQL Server, see if this link helps you: http://www.w3schools.com/sql/sql_top.asp
– MarceloBoni
If SQL Server has
LIMIT
solves your problem? You see that you have theTOP
?– Maniero
Yes, it’s on the link I sent the
TOP
@bigow, in relation to limit the amount of links, Voce would have to bring all records, would continue appearing all page links, what you would do is a treatment via JS and/ or via CSS– MarceloBoni
because I’m going to have to deal with JS anyway, the problem is that I’m really horrible, terrible, with javascript, I don’t understand the logic in general and I’m always avoiding, but I’ll try your solution Mario, from Jpaginate..
– wwwjsw
I’ll try to give you a hand, brother
– MarceloBoni
All right Marty, obg by the help
– wwwjsw