Php Crawlar help

How would you conbined these codes. This is for the search engine

*//This is only displayed if they have submitted the form*
*if ($searching =="yes")*
*echo "<h2>Results</h2><p>";*
*//If they did not enter a search term we give them an error*
*if ($find == "")*
*echo "<p>You forgot to enter a search term";*
*// Otherwise we connect to our Database*
*mysql_connect("", "user_name", "password") or die(mysql_error());*
*mysql_select_db("database_name") or die(mysql_error());*
*// We preform a bit of filtering*
*$find = strtoupper($find);*
*$find = strip_tags($find);*
*$find = trim ($find);*
*//Now we search for our search term, in the field the user specified*
*$data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE'%$find%'");*
*//And we display the results*
*while($result = mysql_fetch_array( $data ))*
*echo $result['fname'];*
*echo " ";*
*echo $result['lname'];*
*echo "<br>";*
*echo $result['info'];*
*echo "<br>";*
*echo "<br>";*
*//This counts the number or results - and if there wasn't any it gives them a little message explaining that*
*if ($anymatches == 0)*
*echo "Sorry, but we can not find an entry to match your query<br><br>";*
*//And we remind them what they searched for*
*echo "<b>Searched For:</b> " .$find;*

This is for the crawler

**$original_file = file_get_contents("");
**$stripped_file = strip_tags($original_file, "<a>");
**preg_match_all("/<a(?:[^>]*)href=\\"([^\\"]*)\\"(?:[^>]*)>(?:[^<]*)<\\/a>/is", $stripped_file, $matches);

**//DEBUGGING remove after it works

**//$matches[0] now contains the complete A tags; ex: <a href="link">text</a>
**//$matches[1] now contains only the HREFs in the A tags; ex: link

**header("Content-type: text/plain"); //Set the content type to plain text so the print below is easy to read!
**print_r($matches); //View the array to see if it worked

It would be best if you could elaborate your question into something more than pasting two random PHP snippets.
It sounds like you are trying to make a search engine using only the two above snippets, which is never going to happen!

I am building a search engine using web crawlers and databases in php I know that is not the only thing you need to build a search engine. I have 48 different scripts. These are my last and main codes. How would you integrate the last and main codes?

A crawler is a process that runs behind the scenes, the search engine itself is the bit the user interacts with - you wouldn’t want those 2 scripts integrating at all.

You would want the crawler to run every however often perhaps scheduled as a cron - perhaps once a day - to run through a list of urls gathered and perform the crawl, then filter and parse the data to a storage device or database.
The frontend site - the search engine - that the users will see will then interact with the already populated database retrieving info as they need.