jam123 Posted July 15, 2010 Share Posted July 15, 2010 Hi All experts, in the below coding I get the expected output with pagination links. But when I click on page 2 link it doesn't show me the result. Any idea?? <?php @session_start(); if(!isset($_SESSION['SESSION'])) { require ("sess.php"); } if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page=1;}; //echo 'cr page'.$page.'<br><br>'; ?> <?php $raw_rst = ""; $record_id = $_POST['record_id']; $file_number = $_POST['file_number']; $name_land = $_POST['name_land']; $location = $_POST['$location']; $page_limit = 2; $start_page = ($page-1)*$page_limit; //echo 'str page'.$start_page.'<br><br>'; /*echo $record_id,'<br>'; echo $file_number,'<br>'; echo $name_land,'<br>'; echo $sec_div,'<br>'; * */ @$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 land_general.Record_id,land_general.file_number,land_general.land_name,land_general.location,land_general.deed_num, land_general.land_reg_name,land_general.extent_acre,land_general.extent_rood,land_general.extent_perch,land_general.extent_hectare, land_general.own_name,land_general.address,land_general.not_name,land_general.Remarks1, land_location.secr_div,land_location.gs_div,land_location.village FROM land_general INNER JOIN land_location ON land_general.Record_id = land_location.Record_id AND land_general.file_number = land_location.file_number WHERE land_general.Record_id = '$record_id' || land_general.file_number = '$file_number' || land_general.land_name = '$name_land' || land_general.location = '$location' ORDER BY land_general.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> <th>Location</th> <th>Deed_num</th> <th>Land_reg</th> <th>secr_div</th> <th>gs_div</th> <th>village</th> <th>acre</th> <th>Rood</th> <th>Perch</th> <th>Hectare</th> <th>Owner</th> <th>Address</th> <th>Notary</th> <th>Remarks</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>'.$rw['location'].'</td>'; echo '<td>'.$rw['deed_num'].'</td>'; echo '<td>'.$rw['land_reg_name'].'</td>'; echo '<td>'.$rw['secr_div'].'</td>'; echo '<td>'.$rw['gs_div'].'</td>'; echo '<td>'.$rw['village'].'</td>'; echo '<td>'.$rw['extent_acre'].'</td>'; echo '<td>'.$rw['extent_rood'].'</td>'; echo '<td>'.$rw['extent_perch'].'</td>'; echo '<td>'.$rw['extent_hectare'].'</td>'; echo '<td>'.$rw['own_name'].'</td>'; echo '<td>'.$rw['address'].'</td>'; echo '<td>'.$rw['not_name'].'</td>'; echo '<td>'.$rw['Remarks1'].'</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>'; }; ?> </tbody> </table> <?php $page_query = "select COUNT(land_general.Record_id) FROM land_general INNER JOIN land_location ON land_general.Record_id = land_location.Record_id AND land_general.file_number = land_location.file_number WHERE land_general.Record_id = '$record_id' || land_general.file_number = '$file_number' || land_general.land_name = '$name_land' || land_general.location = '$location' ORDER BY land_general.Record_id ASC"; $page_query = @mysql_query($page_query) or die (mysql_error()); $page_row = mysql_fetch_array($page_query) 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>".' '.' '; }; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.