搜索没有在分页上运行

时间:2012-11-08 05:14:19

标签: php mysql database search

当我必须搜索任何东西时它给了我正确的sesrch但是当我点击第2页导航以显示更多记录时它没有显示正确的结果。简而言之,我在其上应用了paginatiion但是在点击第二页后,搜索查询不会仅运行简单的查询运行。请告诉我哪个是问题?

    <form method="post" action=""><input type='textbox' name="searchfield" id='searchfield' $value style='height:25px; width:275px; border-radius:5px 5px 5px 5px; margin-top:50px; margin-bottom:50px;' />    <input type="submit" id='GetBtn' name="GetBtn" class='GetBtn' value="Search"></form>

    <?php 

    if(isset($_GET['GetBtn'])){
         $match = str_replace('-',' ',slugify($_POST['searchfield']));

       $query_pag_data = "SELECT * FROM `imported_deals` WHERE MATCH ( `Name`, `Category` )
AGAINST ('$match' IN BOOLEAN MODE)";

    }
     else{   
    $query_pag_data = "SELECT * FROM `imported_deals` LIMIT $per_page ( `Name`, `Category` ) 
AGAINST ('$match' IN BOOLEAN MODE)";
     }

     $PAGING        =   new PAGING($query_pag_data,10);
    $query          =   $PAGING->sql;
    $res                =   mysql_query($query);
    if(!$res) die(mysql_error());


    if($show['subcat_name'] != '')
        {
             echo($PAGING->show_paging("http://yespricer.com/","deals/".slugify($fullname)."/".slugify($show['subcat_name'])."/page")); 
        }
        else
        {
             echo($PAGING->show_paging("http://yespricer.com/","deals/".slugify($fullname)."/page")); 
        }

    ?>

1 个答案:

答案 0 :(得分:0)

无论您从帖子获得什么值,都将它们存储在表单中的隐藏字段中,并将其作为获取/发布数据推送到第二页。