Thanks to tons of great help by some of you one here, I've finally been successful in my first pagination project...well almost.
My script works wonderfully except one tiny hitch. There are 40 "rows' page. When there are no more "rows" to display, the pagination continues to paginate blank pages.
To be more specific. page 13 is the last page with rows on it, but you can still hit next and go onto blank pages.
The solution is obvious - to have the "next" button disappear if there are no rows left, but for some reason all of the if statements I've tried are failing to do so.
Here is the query:
$rowsperpage = 40; // THERE ARE 40 AIRWAVES PER PAGE
$currentpage = (int)$_GET['currentpage']; // This is getting which "page" the user wants to see, and putting it in $currentpage
if ($currentpage > 0) { // If $currentpage is greater than 0, we'll need to compensate by subtracting 1, so that we pull the correct set of results. Otherwise, we'll just start at 0 (see the else)
$offset = ($currentpage - 1) * $rowsperpage;
}
else {
$offset = 0;
}
$query = "SELECT * FROM `CysticAirwaves` WHERE `FromUserID` = `ToUserID` AND `status` = 'active' ORDER BY `date` DESC, `time` DESC LIMIT $offset, $rowsperpage";
$request = mysql_query($query, $connection);
$counter = 0;
while ($result = mysql_fetch_array($request)) {
and here is the pagination links:
// find out how many rows are in the table
$query = "SELECT COUNT(*) FROM `CysticAirwaves`";
$result = mysql_query($query, $connection) or trigger_error("SQL", E_USER_ERROR);
$r = mysql_fetch_row($result);
$numrows = $r[0];
// number of rows to show per page
$rowsperpage = 40;
// find out total pages
$totalpages = ceil($numrows / $rowsperpage);
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
// cast var as int
$currentpage = (int)$_GET['currentpage'];
}
else {
// default page num
$currentpage = 1;
} // end if
// if current page is greater than total pages...
if ($currentpage > $totalpages) {
// set current page to last page
$currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
// set current page to first page
$currentpage = 1;
} // end if
// the offset of the list, based on current page
$offset = ($currentpage + 1) * $rowsperpage;
// while there are rows to be fetched...
while ($list = mysql_fetch_assoc($result)) {
// echo data
echo $list['id'] . " : " . $list['number'] . "<br />";
} // end while
/****** build the pagination links ******/
// range of num links to show
$range = 3;
// if not on page 1, don't show back links
if ($currentpage > 1) {
// show << link to go back to page 1
$prevpage = $currentpage - 1;
echo "<div id='all_page_turn'>
<ul>
<li class='PreviousPageBlog round_10px'>
<a href='http://www.cysticlife.org/Airwave_build.php?currentpage=$prevpage'>Previous</a>
</li>
<ul>
</div>";
} // end if
// if not on last page, show forward and last page links
if ($currentpage != $totalpages)) {
// get next page
$nextpage = $currentpage + 1;
// echo forward link for next page
echo " <div id='all_page_turn'>
<ul>
<li class='PreviousPageBlog round_10px'>
<a href='http://www.cysticlife.org/Airwave_build.php?currentpage=$nextpage'>Next</a>
</li>
</ul>
</div> ";
}
Thanks in advance
Change your
if ($currentpage != $totalpages)) {
to
if ($currentpage < $totalpages) {
For one, there's an extra parenthesesisesis, and you should never rely on exact matching an upper threshold.
Edit:
I think I see the problem. You need to use the same WHERE clause as in your actual select query when doing your COUNT:
$query = "SELECT COUNT(*) FROM `CysticAirwaves` " .
"WHERE `FromUserID` = `ToUserID` AND `status` = 'active'";
Otherwise, you're getting the count of all rows in the table, even ones you're not displaying.
Related
i'm trying to make my own pagination system ignores the new data if someone trying to open the next page:
example:
i have this table :
1. apple
2. orange
3. banana
4. burger
5. pizza
6. spaghetti
and i only show 3 rows for each page.
mysql query:
// $page = 0 for first page
$sql = "SELECT * FROM mytable ORDER BY id DESC LIMIT $page, 3";
the result is like this
page #1 :
6. spaghetti
5. pizza
4. burger
page #2 :
3. banana
2. orange
1. apple
let's say right now I'm in page #1 and someone else added 3 new rows:
water
juice
coffee
what will happen now is if i go to page #2 i will get a repeated page !
now page #2 is gonna be :
6. spaghetti
5. pizza
4. burger
the reason of that is because page #1 is showing the new data:
9. water
8. juice
7. coffee
how can i stop this to happen if the user didn't refresh the first page and only wanted to view the second page ?
it's a problem especially if you're trying to make your pagination looks just like twitter!
// find out how many rows are in the table
$sql = "SELECT COUNT(*) FROM mytable";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
$r = mysql_fetch_row($result);
$numrows = $r[0];
// number of rows to show per page
$rowsperpage = 10;
// find out total pages
$totalpages = ceil($numrows / $rowsperpage);
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
// cast var as int
$currentpage = (int) $_GET['currentpage'];
} else {
// default page num
$currentpage = 1;
} // end if
// if current page is greater than total pages...
if ($currentpage > $totalpages) {
// set current page to last page
$currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
// set current page to first page
$currentpage = 1;
} // end if
// the offset of the list, based on current page
$offset = ($currentpage - 1) * $rowsperpage;
// get the info from the db
$sql = "SELECT * FROM mytable ORDER BY id DESC LIMIT $offset, $rowsperpage";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
// while there are rows to be fetched...
while ($list = mysql_fetch_assoc($result)) {
// echo data
echo $list['id'] . " : " . $list['number'] . "<br />";
} // end while
/****** build the pagination links ******/
// range of num links to show
$range = 3;
// if not on page 1, don't show back links
if ($currentpage > 1) {
// show << link to go back to page 1
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> ";
// get previous page num
$prevpage = $currentpage - 1;
// show < link to go back to 1 page
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> ";
} // end if
// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
// if it's a valid page number...
if (($x > 0) && ($x <= $totalpages)) {
// if we're on current page...
if ($x == $currentpage) {
// 'highlight' it but don't make a link
echo " [<b>$x</b>] ";
// if not current page...
} else {
// make it a link
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> ";
} // end else
} // end if
} // end for
// if not on last page, show forward and last page links
if ($currentpage != $totalpages) {
// get next page
$nextpage = $currentpage + 1;
// echo forward link for next page
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> ";
// echo forward link for lastpage
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> ";
} // end if
/****** end build pagination links ******/
?>
You can use something like this to get proper pagination for your table items. You can remove ORDER BY & DESC to know how the sql query result changes.
$page; // $page is current page
$result = 3; // As you need 3 results per page.
$offset = ($page * $result) - $result;
$sql = "SELECT * FROM mytable ORDER BY id DESC LIMIT $result OFFSET $offset";
i had to use session to make it work as i want it , and here's how i solved it:
$count = $PDO->query("SELECT id FROM mytable")->rowCount(); //count rows
if(!isset($_SESSION['rowCount']))
{
$_SESSION['rowCount'] = $count; // save row counts
}
if(isset($_GET['page']))
{
$offset = ($_GET['page'] -1) * 3 + $count - $_SESSION['rowCount'];
}
else
$offset = 0;
$sql = $PDO->prepare("SELECT * FROM mytable ORDER BY id DESC LIMIT $offset, 3");
$sql->execute();
also i unset the session when user comes back to page 1.
hi i'm trying to paginate a php mysql database, and I can't figure out what make the results move to the next page, it's stuck at record row zero and what do i change to make it go to the next set of results? is this the offset hooked to the nav link somehow does it have to recall a mysql query? how does this work?
//pagination
//find out how many rows are in the table
$sql = "SELECT * FROM hotels_database";
$result = mysql_query($sql, $con) or trigger_error("SQL", E_USER_ERROR);
$r = mysql_fetch_row($result);
$numrows = $r[0];
// number of rows to show per page
$rowsperpage = 2;
// find out total pages
$totalpages = ceil($numrows / $rowsperpage);
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
// cast var as int
$currentpage = preg_replace('#[^0-9]#i','', $_GET['currentpage']);
} else {
// default page num
$currentpage = 1;
} // end if
// if current page is greater than total pages...
if ($currentpage > $totalpages) {
// set current page to last page
$currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
// set current page to first page
$currentpage = 1;
} // end if
// the offset of the list, based on current page
$offset = ($currentpage - 1) * $rowsperpage;
// get the info from the db
$sql = "SELECT * FROM hotels_database LIMIT $offset, $rowsperpage";
$result = mysql_query($sql, $con) or trigger_error("SQL", E_USER_ERROR);
// while there are rows to be fetched...
while ($list = mysql_fetch_assoc($result)) {
// echo data
for ($stars=1;$stars<=floor($list['stars']);$stars++){
$star_string .= "<img src='images/star.jpg'/>";
}
if (($list['stars']-floor($list['stars']))> 0){
$star_string .= "<img src='images/half_star.jpg'/>";
}
$hotels_database .= "<div style='display:table-row;height:70px;'><div style='width:60px;height:60px;display:table-cell;float:left;'><img src='".$list['pic']."' width='60px'/></div>"."<div style='width:280px;display:table-cell;vertical-align:top;text-align:left;padding-left:5px;font-size:12px;'><a href='#' class='database_link'>".$list['hotel']."</a>".$star_string."<br/><span style='font-size:10px;'>".$list['addy']."</span><br/>Guest score: <span style='color:red;font-size:14px;'>".$list['score']."</span> out of 10"."<br/>"."<li class='database_arrow'>Display Amenities & More Info</li>"."</div>"."<div style='width:78px;height:60px;display:table-cell;vertical-align:top;'><span style='font-family:arial;color:green;font-size:15px;'>$".$list['price']."</span><br/>per night<div style='border-radius:10px;background-color:#1284d3;height:25px;width:70px;left:10px;top:10px;position:relative;border:1px black solid;color:white;font-family:arial;line-height:8px;'><br/>select</div><br/></div>"."</div><hr style='color:#c8ff78;'/>";
$star_string="";
} // end while
/****** build the pagination links ******/
// range of num links to show
//pagination
/*
ya, so i can't figure out how to go to the next offset what href do i use in this case? and why isn't the currentpage query string being displayed in my addy bar? please take a look,
As D.N said code would be helpful but in general it goes
if(isset($_GET['offset']) {
$offset = $_get['offset'];
}
else{
$offset = 0;
}
then in the SQL call you add:
'what ever the call is' "limit $limit offset $offset"
*EDIT***
I've made great progress by combining the main query that pulls the airwaves with some variables from the pagination query and have finally gotten the pagination to work. The only problem now is that the first page is blank and page two is correct starting with result 41-80
Here is the query that limits and pulls the airwaves
$rowsperpage = 40;
$currentpage = (int) $_GET['currentpage'];
$offset = ($currentpage - 1) * $rowsperpage;
$query = "SELECT * FROM `CysticAirwaves` WHERE `FromUserID` = `ToUserID` AND `status` = 'active' ORDER BY `date` DESC, `time` DESC LIMIT $offset, $rowsperpage" ;
$request = mysql_query($query,$connection);
$counter = 0;
while($result = mysql_fetch_array($request)) {
and here is the pagination code:
$query = "SELECT COUNT(*) FROM `CysticAirwaves`";
$result = mysql_query($query, $connection) or trigger_error("SQL", E_USER_ERROR);
$r = mysql_fetch_row($result);
$numrows = $r[0];
// number of rows to show per page
$rowsperpage = 40;
// find out total pages
$totalpages = ceil($numrows / $rowsperpage);
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
// cast var as int
$currentpage = (int) $_GET['currentpage'];
} else {
// default page num
$currentpage = 1;
} // end if
// if current page is greater than total pages...
if ($currentpage > $totalpages) {
// set current page to last page
$currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
// set current page to first page
$currentpage = 1;
} // end if
// the offset of the list, based on current page
$offset = ($currentpage - 1) * $rowsperpage;
// get the info from the db
$query2 = "SELECT `id` FROM `CysticAirwaves` LIMIT $offset, $rowsperpage";
$result = mysql_query($query2, $connection) or trigger_error("SQL", E_USER_ERROR);
// while there are rows to be fetched...
while ($list = mysql_fetch_assoc($result)) {
// echo data
echo $list['id'] . " : " . $list['number'] . "<br />";
} // end while
/****** build the pagination links ******/
// range of num links to show
$range = 3;
// if not on page 1, don't show back links
if ($currentpage > 1) {
// show << link to go back to page 1
echo " <a href='http://www.cysticlife.org/Airwave_build.php?currentpage=1'><<</a> ";
// get previous page num
$prevpage = $currentpage - 1;
// show < link to go back to 1 page
echo " <a href='http://www.cysticlife.org/Airwave_build.php?currentpage=$prevpage'><</a> ";
} // end if
// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
// if it's a valid page number...
if (($x > 0) && ($x <= $totalpages)) {
// if we're on current page...
if ($x == $currentpage) {
// 'highlight' it but don't make a link
echo " [<b>$x</b>] ";
// if not current page...
} else {
// make it a link
echo " <a href='http://www.cysticlife.org/Airwave_build.php?currentpage=$x'>$x</a> ";
} // end else
} // end if
} // end for
// if not on last page, show forward and last page links
if ($currentpage != $totalpages) {
// get next page
$nextpage = $currentpage + 1;
// echo forward link for next page
echo " <a href='http://www.cysticlife.org/Airwave_build.php?currentpage=$nextpage'>></a> ";
// echo forward link for lastpage
echo " <a href='http://www.cysticlife.org/Airwave_build.php?currentpage=$totalpages'>>></a> ";
} // end if
/****** end build pagination links ******/
?>
So long story short, I just am not able to pull the first 40 results but after that its fine
This is a better way to go about pagination:
SELECT SQL_CALC_FOUND_ROWS id FROM `CysticAirwaves` LIMIT $offset, $rowsperpage
Select the data you want to display using the example query above which will return the same result as your query2
Then execute another SQL query:
SELECT FOUND_ROWS()
This will return the number of rows found without using a limit. See more here:
http://dev.mysql.com/doc/refman/5.0/en/limit-optimization.html
This would be the fastest way to manage pagination.
You would then loop through the results of your first query and display then. All you need to keep track of is what page you are on, and how many rows to show per page.
If you page number * $rowsperpage > the result of the second select (FOUND_ROWS) then you do not need to calculate or show the 'next' pages options/links.
For 'next' pages, loop 3 times incrementing the page number or next page * $rowsperpage > total rows.
For 'previous' pages, loop 3 times decrementing the page number or previous page = 1 (break out of loop in this case).
That should do the trick.
Probably you code so much, that it's hard to read what you've once written. You seem to put a comment next to each line of code, which might underline that. So you probably should reduce the code to reduce this problem.
This is just a suggestion, you wrote:
// if current page is greater than total pages...
if ($currentpage > $totalpages) {
// set current page to last page
$currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
// set current page to first page
$currentpage = 1;
} // end if
All these if clauses you need to deal with! All these comments to read! Isn't that a burden?
// currentpage must be within 1 and total of pages.
$currentpage = max(1,min($totalpages, $currentpage));
How about that? If you have problems to understand it, you can put some comments on top that explain it as you do as well in your code - in your words if mine are not fitting, it's just a suggestion.
I've tried a load of different code snippets that are out there for using pagination in my result set. I've got the same problem in each case. Using LIMIT on the end of the query I can display the first page correctly along with the navigation links for the correct number of pages (so the code doing the calculations with number of rows returned and number to display on each page is right), but when you click to follow the link to any of the other pages then they're blank. So how do I get the updated query to run again and display my results on the subsequent pages?
This is one piece of code that I've tried:
$rowsperpage = 10;
$totalpages = ceil($numrows / $rowsperpage);
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { $currentpage = (int) $_GET['currentpage']; }
else { $currentpage = 1; }
// if current page is greater than total pages...
if ($currentpage > $totalpages) { $currentpage = $totalpages; }
// if current page is less than first page...
if ($currentpage < 1) { $currentpage = 1; }
// the offset of the list, based on current page
$offset = ($currentpage - 1) * $rowsperpage;
// run the query
$sql = "SELECT * FROM table WHERE keyword LIMIT $offset, $rowsperpage";
$result = mysql_query($sql, $link) or trigger_error("SQL", E_USER_ERROR);
// while there are rows to be fetched...
while ($list = mysql_fetch_assoc($result))
{
//echo data for each record here
}
// building pagination links
$range = 3;
// if not on page 1, don't show back links
if ($currentpage > 1) {
// show << link to go back to page 1
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> ";
// get previous page num
$prevpage = $currentpage - 1;
// show < link to go back to 1 page
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> ";
} // end if
Not permitted to show rest of navigation code due to too many hrefs, but the links appear correctly. The problem seems to be how the query is carried over to the next page.
You have to use limit offset, rowcount.
Typically for nth page
offset= (n-1)*pagesize and rowcount=pagesize
I've already created a query to mysql that will give 20 results from mysql table etc. "cat"
heres the calling:
if(isset($_GET['cat']))
{
$query = "SELECT game_title,game_desc,....
FROM games WHERE cat_id='".validate_input($_GET['cat'])."' LIMIT 20";
}
...
by this I manage to get the results I wanted. What I am asking here is how can I create a "button" that will load the next "20" records from table "cat" (something like Buttons).
<?
$cn=mysql_connect("localhost","root","root") or die(mysql_error());
mysql_select_db("db56") or die(mysql_error());
$sql="select count(*) from emp";
$result=mysql_query($sql);
$r=mysql_fetch_row($result);
$record=$r[0];
$pagesize=20;
$totalpages=$record/$pagesize;
$currpage=$_GET["pg"];
if(!isset($currpage))
$start=0;
else {
$currpage--;
$start= $currpage * $pagesize;
}
$end=$start+$pagesize;
$sql="select * from emp limit $start,$pagesize";
$result=mysql_query($sql);
if($result){
print "<table border='1'>";
print "<tr><th>No</th><th>Name</th><th>Date</th></tr>";
while($r=mysql_fetch_row($result))
{
print "<tr><td>$r[0]</td><td>$r[1]</td><td>$r[2]</td></tr>";
}
print "</table>";
}
for($i=1;$i<=$totalpages;$i++){
print "<a href='listemp.php?pg=$i'> $i </a>";
}
?>
If you keep track of what page you're on, in the URL or a hidden field or session variable, you can use that to work out the limit. For example, page 2 should show limit 20 from row 20 (20 times the page offset).
You can pass two SQL parameters to LIMIT (put a comma between them) If you do, the first tells SQL how many records to skip (ie the offset of the first record) and the 2nd parameter is the one you're already using (how many records to return).
So just put a variable in your "next" link that says what page to display. You can pass the offset in this link, but it's pretty common to pass the "page number" instead, and multiply by the number of records per page before sticking it in the sql.
next page
With a bit more work, you can make a "previous page" link, and make the correct links non-clickable when you're at the first/last page.
Pass along a parameter that tells the script that you want another chunk of the results and not just the first batch.
So for the link it could be like this:
example.com/results.php?cat=1&page=2
Where page= will tell the script what page you want to return.
Then you want to turn that LIMIT number you have so that you can work out some simple maths
$results_cnt = 20; //--rows you want per page of results
Now in your script you'll check to see if the page variable has been set. If not, default the start row to return from the first. But as you want to return different pages/sets of results, a little math is needed in order to start at the proper row.
if(isset($_GET["page"]) //--see if the variable is even there
{
$page_num = (int)$_GET["page"]; //--forcing it to always be an integer
$start_row = $results_cnt * ($page_num - 1);
/* --
what happens:
($results_cnt currently at 20)
on page one (page=1), start at row 0
math: 20 * (1 - 1) = 0
on page two (page=2), start at row 20
math: 20 * (2 - 1) = 20
on page three (page=3), start at row 40
math: 20 * (3 - 1) = 40
etc.
*/
}
else
$start_row = 0;
Now, having set the correct starting row, adjust the SQL query to use the variables like so:
if(isset($_GET['cat']))
{
$query = "SELECT game_title,game_desc,....
FROM games
WHERE cat_id='".validate_input($_GET['cat'])."'
LIMIT $start_row, $results_cnt";
}
OK I got it fixed I guess...
in index.php:
<?php
$games = array();
$count = 1;
$total = 0;
if(isset($_GET['cat']))
{
$query = "SELECT game_title,game_desc,.... FROM games WHERE cat_id='".validate_input($_GET['cat'])."' LIMIT 20";
$total = mysql_num_rows(mysql_query("SELECT 1 FROM games WHERE cat_id='".validate_input($_GET['cat'])."'"));
}
$query_result = #mysql_query ($query) OR error(mysql_error(), __LINE__, __FILE__, 0, '', '');
while ($info = #mysql_fetch_array($query_result))
{
/* -- here goes the infos.. */
$games[$info['game_title']]['game_title'] = $info['game_title'];
etc..
if(isset($_GET['cat']))
{
/* -- for template engine */
$page->SetLoop ('PAGES', pagenav($total,$_GET['page'],20,$config['site_url'].'?cat='.$_GET['cat'],1,$lang));
}
--end php
and in funct.php
--start php
function pagenav($total,$page,$perpage,$url,$posts=0)
{
$page_arr = array();
$arr_count = 0;
if($posts)
{
$symb='&';
}
else
{
$symb='?';
}
$total_pages = ceil($total/$perpage);
$llimit = 1;
$rlimit = $total_pages;
$window = 5;
$html = '';
if ($page<1 || !$page)
{
$page=1;
}
if(($page - floor($window/5)) <= 0)
{
$llimit = 1;
if($window > $total_pages)
{
$rlimit = $total_pages;
}
else
{
$rlimit = $window;
}
}
else
{
if(($page + floor($window/2)) > $total_pages)
{
if ($total_pages - $window < 0)
{
$llimit = 1;
}
else
{
$llimit = $total_pages - $window + 1;
}
$rlimit = $total_pages;
}
else
{
$llimit = $page - floor($window/2);
$rlimit = $page + floor($window/2);
}
}
if ($page>1)
{
$page_arr[$arr_count]['title'] = 'Prev';
$page_arr[$arr_count]['link'] = $url.$symb.'page='.($page-1);
$page_arr[$arr_count]['current'] = 0;
$arr_count++;
}
for ($x=$llimit;$x <= $rlimit;$x++)
{
if ($x <> $page)
{
$page_arr[$arr_count]['title'] = $x;
$page_arr[$arr_count]['link'] = $url.$symb.'page='.($x);
$page_arr[$arr_count]['current'] = 0;
}
else
{
$page_arr[$arr_count]['title'] = $x;
$page_arr[$arr_count]['link'] = $url.$symb.'page='.($x);
$page_arr[$arr_count]['current'] = 1;
}
$arr_count++;
}
if($page < $total_pages)
{
$page_arr[$arr_count]['title'] = 'Next';
$page_arr[$arr_count]['link'] = $url.$symb.'page='.($page+1);
$page_arr[$arr_count]['current'] = 0;
$arr_count++;
}
return $page_arr;
}
?>
and call it by
{LOOP: PAGES}{PAGES.title} {/LOOP: PAGES}
in an .html file..
it works perfectly but when I press the number 2 or next to get the next 20 records it jumps back to the first 20...
on the browser it reads http://siteurl/?cat=1&page=2
I can't figure out why.