News searching script - how to add simple pagination ?
Posted: Tue Jun 09, 2009 10:34 pm
Hello eveybody,
i have the follow script which is searching for news stored in mysql-database :
Its works fine , just am wondering on how we can add some pagination to it so that the result will come par example 4 from 10 if there are 10 results .
Can anyone give an example on how we can modify the code above so that will include pagination for our results ..!?
Thanks in advance
i have the follow script which is searching for news stored in mysql-database :
Code: Select all
<?
$find = $_GET['newsearch'];
$find = mysql_real_escape_string($find);
if ($find == "")
{
echo "Empty search - write a term please !"
}
else
{
$newsquery = "SELECT * FROM newslist WHERE MATCH(newsid,newstopic) AGAINST('$find*' IN BOOLEAN MODE)";
$inorder = mysql_query($newsquery) or die("Problem occured..");
$count = mysql_num_rows($inorder);
echo "<strong>Search Results</strong>";
$calcRows = mysql_num_rows($inorder);
$iterator = 0;
while ($iterator <$calcRows)
{
$theid = mysql_result($inorder, $i, "newsid");
$thetopic = mysql_result($inorder, $i, "newstopic");
echo "$newsid<p> </p>";
echo "$newstopic";
$iterator ++;
}
}
?>
<form action="news.php" method="get">
<input type="text" name="newsearch" size="100" />
<input type="submit" name="Look for news" />
</form>Can anyone give an example on how we can modify the code above so that will include pagination for our results ..!?
Thanks in advance