Have an account? Sign in
Login  Register  Facebook
pagination not working with where clause
table name - news

I create pagination code

here I am passing city and state from Navigation bar.
And on basis of that i Tried to show Row with pagination pages.

It works but on 2,3,4,5...N pages it shows error.

Simply Pagination Not fetching data with where condition.
plz suggest proper solution.

when page loads it gets url like
and display pagination rows below.

But when i click on page2 it show url like
and shows

Undefined index: city
Undefined index: state

$Admin = new admins;
$baseString = "detail.php";
$cit = $_REQUEST['city'];
$sta = $_REQUEST['state'];

$page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]);
$limit = 1;
$startpoint = ($page * $limit) - $limit;
$statement = "news where state_id = '$sta' and city_id = '$cit'";
$sql="select id,story,headline,photo from {$statement} order by id desc LIMIT {$startpoint} , {$limit}";
Started: December 20, 2014 Latest Activity: December 20, 2014 php pagination mysql
Your Answer

xDo you want to answer this question? Please login or create an account to post your answer