You would do that in your query, so that you only ever get the data you need. It's usually best to let the database do the work it can, because it's much faster! Here's an example:
// To get all books with the letter "a" in them
// Query looks like this: SELECT * FROM books WHERE title LIKE '%a%'
// Assume your input comes from a form using the post method
$query = "SELECT * FROM books WHERE title LIKE '%".$_POST['sch_title']."%'";
$result = mysql_query($query, $db) or die(mysql_error());
This is a very basic form of searching. The %'s in the LIKE parameter of the where clause are wildcards. So, if the user did a search for "a", using that query, it would return all of the results in your database that contain the letter a in the title. If the user did a search for "pie", it would return all of the results that contain the string "pie" in the title.
I would suggest having a look at http://www.sqlcourse.com and http://www.sqlcourse2.com so you can learn a bit more about sql queries. Also, the documentation for mysql is fantastic. Have a look on their website at that too, you'll learn a lot!
Hope that helps,
Matt