guys i am really stuck in this tried couples of ways but didnt get it right please help.My pagiantion is working fine and great untill i specfies WHERE CLAUSE in it.I am trying to have a text field so that if a user enter the interger for class search e.g 8.Pagination search records WHERE class is 8 BUT it show me record only on the first page but when i turn to second page it show a empty page.Please Help me
<?php
session_start();
mysql_connect("localhost","root","");
mysql_select_db("project");
$_SESSION['class'] = $_POST['test'];
echo $class = $_SESSION['class'];
$per_page = 6;
$pages_query = mysql_query("SELECT COUNT('id') FROM `stu_info`[B] WHERE `classess` = '$class'[/B]");
$pages = ceil(mysql_result($pages_query, 0)/$per_page);
$page = (isset($_GET['page'])) ? (int)$_GET['page'] :1 ;
$start = ($page-1)* $per_page;
$query = mysql_query("SELECT * FROM `stu_info`[B] WHERE classess = '$class'[/B] LIMIT $start, $per_page");
while($query_row=mysql_fetch_assoc($query))
{
echo '<p>'.$id = $query_row['id'].'<p/>';
}
if($pages >=1 && $page<$pages){
for($x=1; $x<=$pages; $x++){
echo ($x == $page)? '<strong><a href="?page='.$x.'">'.$x.'</strong></a> ': '<a href="?page='.$x.'">'.$x.'</a> ';
}}
?>