Erm, your request is very general. I don't have time to write you a whole script for this. Also, this should really be in the database forum.
Your sql will be something like this:
SELECT table1.email, table1.search, table2.product FROM table1, table2 WHERE table1.email=$email AND (table2.product LIKE table1.search) LIMIT 1
And PHP could be something like this:
if (mysql_num_rows($result)>0)
{
mail("$email", "Your search has been found!", "Your search for $search has found the following result: $product");
}
There is a bunch of stuff in between that you will need to look up, such as getting the results of the query into variables such as $product. Look up all the functions you don't understand at www.php.net. Example code below:
$sql = "SELECT uid FROM ml_users WHERE email=\"$email\"";
$result = @mysql_query($sql,$GLOBALS['connection']);
if (!$result)
{
$error = mysql_error();
echo "<p><font face=\"verdana\" size=\"2\">Sorry, count user has failed<BR> $error, $sql</font>";
exit();
}
while ($row = mysql_fetch_array($result))
{
$uid = $row['uid'];
}
mysql_free_result($result);