Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.