Below is a segment of code i am using
$find = strtoupper($search);
$find = clean_input($search);
$find = trim ($search);
$split = (str_word_count("$find",1));
if (!isset($pagenum))
{
$pagenum = 1;
}
foreach($split as $string) {
$string = $string;
}
$searchstring .= "upper(col_1) LIKE '%$string%' || upper(col_2) LIKE '%$string%' || upper(col_3) LIKE '%$string%'";
$data = mysql_query("SELECT * FROM db_table WHERE $searchstring") or die(mysql_error());
$rows = mysql_num_rows($data);
$page_rows = 4;
$last = ceil($rows/$page_rows);
if ($pagenum < 1)
{
$pagenum = 1;
}
elseif ($pagenum > $last)
{
$pagenum = $last;
}
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
if($rows!=0) {
$data_p = mysql_query("SELECT * FROM db_table $max") or die(mysql_error());
$rows=mysql_num_rows($data_p);
?>
<p style="font-size:12px; color:#003399; margin-left:20px" align="left">Results for search: <strong><em><?=$find?></em></strong></p>
<?
while($info = mysql_fetch_array( $data_p )) {
?>
<div style="margin:20px">
<div id="ll-header"><a href="<?=$info['col_1']?>" target="_blank">
<?=$info['col_1']?>
</a></div>
<div id="ll-cont">
<?=$info['col_2']?>
</div>
<div id="ll-url"><a style="color:green" href="<?=$info['col_3']?>" target="_blank">
<?=$info['col_3']?>
</a></div>
</div>
<?
}
?>
<!-- Pagination Start -->
<div style="width:750px; padding:20px; text-align:center; float:left">
<?
if ($pagenum == 1)
{
}
else
{
$previous = $pagenum-1;
?>
<a class="Pag-txt" href="<?=$currentPage?>?pagenum=<?=$previous?>"><strong>Previous</strong></a><?
}
for($l = 1;$l <= $last;$l++)
if($l == $pagenum) {
?>
<a class="Pag-Focus" href="<?=$currentPage?>?pagenum=<?=$l?>">[<?=$l?>]</a>
<? } else { ?>
<a class="Pag-txt" href="<?=$currentPage?>?pagenum=<?=$l?>"><?=$l?></a>
<? } ?>
<?
if ($pagenum!=$last) {
$next = $pagenum+1;
?>
<a class="Pag-txt" href="<?=$currentPage?>?pagenum=<?=$next?>&submit=yes&find=<?=$find?>"><strong>Next</strong></a>
<?
}
}
?>
Its pulling the information from the database but when i click on the paging links its resetting the query. I know there is a problem and i know i could sort it if i knew where it was, I am just cant see the wood for the tree’s.
Can someone offer some assistance