Im trying to search a database and show the results. If a person types in a last name and first name it will search the database and return a result. Heres the cod ei am working with. but im running into errors. Any help would be great thanks.

<html>
<head>
<title></title>
</head>
<body>
<h1>E-mail Results</h1>
<?php
$searchtype = $HTTP_POST_VARS;
$searchterm = $HTTP_POST_VARS;

if (!$searchtype || !$searchterm)
{
echo 'you have not entered all details.nnnnn.';
exit;
}
$searchtype = addslashes($searchtype);
$searchterm = addslashes($searchterm);

@ $db = mysql_pconnect('localhost','jblifegu','8sea92monk');

if (!$db)
{
echo 'Error.';
exit;
}

mysql_select_db('jblifeguard');
$query="select * from Email where ".$searchtype." like'%".$searchterm."%'";
$result =mysql_query($query);

echo'<p>number:'.$num_results.'</p>';

for ($i=0; $i <num_results; $i++)
{
while($row = mysql_fetch_array($result)) {
echo '<p><strong>'.($i+1).'.title:';
echo ($row);
echo '</strong><br/>Author:';
echo ($row);
echo '<br/>Isbn:';
echo ($row);
echo '<br/>Price:';
echo ($row);
echo '</p>';

}
?>
</body>
</html>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.