Jump to content

Number of search results to display


DanielHardy

Recommended Posts

Hi,

 

I have a very simple search code that searches my database and displays results on the page. However, with certain searches there is too many results and the results interfere with the design of my page. Therefore I need to print out only a certain amount of results, and include a "next results" link or something similar.

 

Here is my script :

 

<?php 

      mysql_connect ("localhost", "root","")  or die (mysql_error());

mysql_select_db ("wyrleyjuniors");

 

 

$term = $_POST['term'];

 

 

$sql = mysql_query("select * from players where Player like '%$term%'");

 

 

 

 

while ($row = mysql_fetch_array($sql))

 

   

echo $_POST['$term'];

 

    echo '<b><font color ="red">Name:</font></b> '.$row['Player'];

echo '<b><font color ="red"> Position:</font></b> '.$row['Position'];

    echo '<p><b><font color ="red">Team:</font></b> '.$row['Team']; 

     

    echo '<br/><br/>'; 

   

 

 

 

?>

 

 

 

Could someone please tell me how to do achieve my aim? I know I need to use something like "$limit = 0;" but I'm not sure how to integrate it.

 

All help will be greatly appreciated.

 

Dan

Link to comment
https://forums.phpfreaks.com/topic/133095-number-of-search-results-to-display/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.