Jump to content

paging problem


powaz

Recommended Posts

need help with paging....

<?php

function one(){          //on loading page doing search of all values and doing pagging

$rowsPerPage = 20;

$pageNum = 1;

if(isset($_GET['page']))

{    $pageNum = $_GET['page'];}

$offset = ($pageNum - 1) * $rowsPerPage;

$query = " SELECT * FROM company  LIMIT $offset, $rowsPerPage";

$result = mysql_query($query) or die('Error, query failed');

while($row = mysql_fetch_array($result))

{  echo $row['name'] . '<br>';}

}

function second(){                //on submiting form - searching information and doing wrong paging...

$rowsPerPage = 20;

$pageNum = 1;

if(isset($_GET['page']))

{    $pageNum = $_GET['page'];}

$offset = ($pageNum - 1) * $rowsPerPage;

$uzklausa1="SELECT * FROM company WHERE

name like '%".$name."%' and code like '%".$code."%'and city like '%".$city."%'" LIMIT $offset, $rowsPerPage";;

$result = mysql_query($query) or die('Error, query failed');

while($row = mysql_fetch_array($result))

{  echo $row['name'] . '<br>';}

}

?>

one reload page i using function one()... doing paging, on this page also i have form, and then i submiting this form - search.

when i doing search, values in first page of paging are ok, but then i want to go to second ect pages i'll get back the values of function one() (the values of previously page). 

I thing its $_GET['page'] problem, because it gets the last value of page from function one() paging;, on function second() i need to get clean url line i think of something like that  ???

May be you have some ideas haw to do this, or you know the better scripts of paging.

Thank you form your answers.

 

Have a nice day.

 

Link to comment
https://forums.phpfreaks.com/topic/51999-paging-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.