...

View Full Version : problem with pagination



_user
01-23-2012, 08:12 AM
after submit a search the url with the results would be www.domain.com/link.php="the searched options"&submit=submit

and my pagination link code is something like that:
$page_numerotation .= ($x == $page) ? '<strong>' . $x . '</strong> ' : '<a href="?page=' .$x. '"> ' . $x . '</a> ';

and it looks something like that:
www.domain.com/link.php?page=2 (or 3, or 4, ...)
and obviously dosn't works...

so... how can I fix the problem?

ty

BluePanther
01-23-2012, 08:19 AM
Really depends on how your pagination is actually working, but I'm guessing changing the anchor's href to www.domain.com/link.php="the searched options"&submit=submit&page=x.

_user
01-23-2012, 08:29 AM
my cod is starting with this line


if($_GET){

BluePanther
01-23-2012, 08:34 AM
my cod is starting with this line


if($_GET){

Doesn't tell me anything - any .php page with a query string will use $_GET somewhere.

Try what I said above.

_user
01-23-2012, 08:48 AM
I have any $_POST LINE

with that line starts the code...

than query line

and than

$per_page = 10;
$pages_query = mysql_query ("SELECT COUNT('ID') FROM table");
$pages = ceil(mysql_result($pages_query, 0) / $per_page);

$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
$start = ($page - 1) * $per_page;


$results_list = mysql_query($query_list) or die(mysql_error());
$results = mysql_query($query) or die(mysql_error());
$count = mysql_num_rows($results_list);
if($count > 1){
$search_output .="<hr />$count results <br />";
while($row = mysql_fetch_array($results)){

blablabla

}}
if($pages >= 1 && $page <= $pages){
for ($x=1; $x<=$pages; $x++){
$page_numerotation .= ($x == $page) ? '<strong>' . $x . '</strong> ' : '<a href="?page=' .$x. '"> ' . $x . '</a> ';
}

BluePanther
01-23-2012, 08:58 AM
Yup, my first reply will work.

In the future, use [PHP] tags to wrap your PHP code.

_user
01-23-2012, 09:04 AM
ok... but change what? where?
I don't use no $_POST

I`v changed the firs line with that... and gives no results on searching....

_user
01-23-2012, 11:55 AM
I rerwite the cod and now works.
I don't know wich was the problem, but... now works fine.
Thank you for your time...

BluePanther
01-23-2012, 04:37 PM
All you needed to do was change the <a> tag's href for the next page to include the search string as well, just like I said in my first reply.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum