Hi guys.
I have a little problem in pagination of searching script.
The following are the form code:
The following are the php code for searching:PHP Code:<form method='get' action=''>
<input type='text' name='search'>
<input type='submit' name='submit' value='Search'>
</form>
Now the problem is if click the next link suppose it have to go to 2nd page, it works but i did not see anyPHP Code:<?php
if($_GET['submit']){
$rowsPerPage= 10;
$pageNum = 1;
if(isset($_GET['page'])) { $pageNum = $_GET['page']; }
$offset = ($pageNum - 1) * $rowsPerPage;
echo "Results";
echo '<br>';
$sql2="select * from courses_add where courses_add like '%$search%' LIMIT $offset, $rowsPerPage ";
$select2=mysql_query($sql2);
$numrows2=mysql_num_rows($select2);
echo "Your search keyword return ".$numrows2." results";
echo '<br>';echo '<br>';
$query_count = "SELECT COUNT(*) AS page_count_rows FROM courses_add where courses_add like '%$search%'";
$result_count = mysql_query($query_count) or die(mysql_error());
$row_count = mysql_fetch_array($result_count, MYSQL_ASSOC);
$page_count_rows = $row_count['page_count_rows'];
$maxPage = ceil($page_count_rows/$rowsPerPage);
if($maxPage>200){
$maxPage = 200;
}
$self = $_SERVER['PHP_SELF']; $nav_page = '';
while($row2=mysql_fetch_object($select2)){
$term1=$row2->courses_add;
$c_id=$row2->c_id;
echo $term1;
echo '<br>';
}
}
?>
<br>
<?php
if ($page_count_rows>10){
?>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td><hr noshade color="#6699FF" align="left" width="100%" size="1"> </td>
</tr>
<tr>
<td align="center">
<?php
include('paging.php');
?>
</td>
</tr>
</table><br>
<?php } ?>
data there.
I work out on this last night but no luck.
Can any one give some helpful hints.
Thanks in advance.




Bookmarks