View Full Version : problem with pagination

01-23-2012, 09: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?


01-23-2012, 09: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.

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


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


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

Try what I said above.

01-23-2012, 09: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)){


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

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

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

01-23-2012, 10: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....

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

01-23-2012, 05: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.