Eror in Paging
Posted: Fri Jul 16, 2010 10:31 am
Dear experts,
I am really stucked with below coding. Below is the Code with paging.when executed the fist page result is shown correctly with all page numbers. But 2nd,3rd,4th etc. page results are not shown when clicked. Please help..
I am really stucked with below coding. Below is the Code with paging.when executed the fist page result is shown correctly with all page numbers. But 2nd,3rd,4th etc. page results are not shown when clicked. Please help..
Code: Select all
<?php
@session_start();
if(!isset($_SESSION['SESSION'])) {
require ("sess.php");
}
if (isset($_GET['page'])) { $page = $_GET['page']; }
else { $page=1;};
echo 'page'.$page.'<br><br>';
?>
<?php
$raw_rst = "";
$page_limit = 2;
$start_page = ($page-1)*$page_limit;
$record_id = $_POST['record_id']; ;
$file_number = $_POST['file_number'];
$name_land = $_POST['name_land'];
$location = $_POST['location'] ;
@$connect = mysql_connect($_SESSION['server'],$_SESSION['un'],$_SESSION['pass'])
or die ('Error : Unable to connect to the MYSQL Server');;
@mysql_select_db($_SESSION['db']) or die ('Error : Unable to connect to the Data Base');
$query = "select Record_id,file_number,Land Name from TABLE
where file_number = '$file_number' ||
Record_id = '$record_id' ||
land_name = '$name_land' ||
location = '$location'
ORDER BY Record_id ASC LIMIT $start_page,$page_limit";
$query1 = @mysql_query($query) or die (mysql_error());
?>
<table border="1">
<thead>
<tr>
<th>Record ID</th>
<th>file_number</th>
<th>Land Name</th>
</tr>
</thead>
<tbody>
<?php
while ($rw = mysql_fetch_array($query1)) {
$k = $rw['Record_id'];
echo '<tr>';
echo '<td>'.$rw['Record_id'].'</td>';
echo '<td>'.$rw['file_number'].'</td>';
echo '<td>'.$rw['land_name'].'</td>';
echo' <td>';
echo'<form action="dlt_grid.php" method = "GET">';
echo'<input type="submit" value="Delete">';
echo'<input type="hidden" name="hf" value="'.$k.'">';
echo'</form> ';
echo'</td>';
echo '</tr>';
};
$page_query = "select COUNT(Record_id)
FROM land_general
WHERE Record_id = '$record_id'
|| file_number = '$file_number'
|| land_name = '$name_land'
|| location = '$location' ";
$page_qry = @mysql_query($page_query) or die (mysql_error());
$page_row = mysql_fetch_array($page_qry) or die (mysql_error());
$total_records = $page_row[0];
echo 'tot rec'.$total_records.'<br><br>';
$total_pages = ceil($total_records / $page_limit);
for($i=1;$i<=$total_pages;$i++) {
echo"<a href='searching.php?page=".$i."'>".$i."</a>".' '.' ';
};
?>
</tbody>
</table>