Jump to content

search limit


chris_s_22

Recommended Posts

Can anyone show me or point me in direction of a tutorial that limits search results

1) i want to limit the number of rows that will show up in total eg 500 / 998 so only the 500 can be viewed.

2) i also want to display 10 results per page and have link to next 10 and previous 10 as well as option to jump straight to page ?

$result = mysql_query ("SELECT * FROM table_name WHERE column_name LIKE '%$search_entered%' "); 
$row=mysql_num_rows($result);

echo "<table>";
while($row=mysql_fetch_array($result)) 
{
$column1 = $row["column1 "];
$column2 = $row["column2 "];
$column3 = $row["column3 "];
echo "<td>$column1 <td>";
echo "<td>$column2 <td>";
echo "<td>$column3 <td>";
}
echo "</table>";

Link to comment
Share on other sites

Look up information on the LIMIT keyword for mysql strings

SELECT * FROM `your_table` LIMIT 0, 10 

 

This will limit results from 0 to 10. I would just do a get string in your url for the starting record number and then limit from that variable to that + 10 or whatever

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.