有没有办法让我在搜索结果页面上显示更多按钮?

时间:2015-03-15 10:02:03

标签: php html

我创建了一个名为tantami.com的网站,我一直试图找到的是我能否在搜索结果页面上查看更多链接。这样,如果用户输入的关键字超过20个结果,页面将显示20,底部有一个按钮,其上有一个视图更多链接。我已经尝试了很多不同的方法来做这个,除了HTML,CSS和PHP之外,我对Javascript或其他语言不是很好

以下是搜索结果页面的代码:

<?php

include("center.php")

?>

<hr>

    <div id="right">
        <h1>Adverts</h1>
        <p></p>
        <center>
        <a href="https://thehostgroup.com/billing/aff.php?aff=045"><img src="http://thehostgroup.com/banners/120x600.gif" alt="The Host Group" title="banners/120x600" width="120" height="600" class="alignnone size-full wp-image-322" /></a></center>
    </div>
  <div class="item">
    <div id="left">


        <?php

        $button = $_GET ['submit'];
        $search = $_GET ['search']; 

        if(!$button)
        echo "<p>Sorry but we can't find any results if you do not submit a keyword</p>";
        else
        {
        if(strlen($search)<=1)
        echo "<p>Sorry but the search term you provided is too short for us to find any items related.</p> ";
        else{
        echo "<p>You searched for <b>$search</b> <hr size='1'></br></p><p>If your site hasn't shown up just visit the Members area and submit it!</p>";
        mysql_connect("localhost","User","Password");
        mysql_select_db("Database");

        $search_exploded = explode (" ", $search);

        foreach($search_exploded as $search_each)
        {
        $x++;
        if($x==1)
        $construct .="keywords LIKE '%$search_each%'";
        else
        $construct .="AND keywords LIKE '%$search_each%'";

        }

        $construct ="SELECT * FROM searchengine WHERE $construct";
        $run = mysql_query($construct);

        $foundnum = mysql_num_rows($run);

        if ($foundnum==0)
        echo "<p>Sorry, there are no matching results for <b>$search</b>.</br></br>1. 
        Try more general words. for example: If you want to search 'how to create a website'
        then use general keyword like 'create' 'website'</br>2. Try different words with similar
         meaning</br>3. Please check your spelling.</br>4. If you have any ideas on sites you want to show up submit it to our database.</p>";
        else
        {
        echo "<p>We found $foundnum results!</p>";

        while($runrows = mysql_fetch_assoc($run))
        {
        $title = $runrows ['title'];
        $desc = $runrows ['description'];
        $url = $runrows ['url'];

        echo "
        <p><a href='$url'><b>$title</b></a><br>
        $desc<br>
        <a href='$url'>$url</a></p>

        ";

        }
        }

        }
        }

        ?>
    </div>
  </div>    
</div>
<center>

</center>

<?php

include("footer.php")

?>

如果有人能够帮我这么做,那将会对我有所帮助!

由于

0 个答案:

没有答案