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.

<h1>E-mail Results</h1>
$searchtype = $HTTP_POST_VARS;
$searchterm = $HTTP_POST_VARS;

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

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

if (!$db)
echo 'Error.';

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


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>';


Be a part of the DaniWeb community

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