im using a search form to serach my sql database to return on the requiered infromation but it seems to retive all the info, what i wnat the serach to do is if some1 types in say nokia and n97 for it to return just the results for nokia n97 and not all the nokia phones like its doin now this may be simple for some1 but its been doing my head for days any help would be appreciated my codes is below.
FORM action="form2.php" method="post">
<P>
Enter make of phone: <INPUT type="text" name="make"><br>
Enter model of phone: <INPUT type="text" name="model">
</P>
<P>
<INPUT type="submit" value="Search">
</P>
</FORM>
<
<?
$dbServer=mysql_connect("localhost","0924472","402hqo");
if (!$dbServer) {echo "Failed to connect to MySQL"; exit; }
mysql_select_db("db0924472",$dbServer);
$sql ="SELECT * FROM mobilephones";
$sql.=" WHERE make=\"".$_POST["make"]."\""; // the space before the WHERE is critical
$queryResult=mysql_query($sql);
if (mysql_error())
{
echo "Problem with Query<BR>";
echo "The following error message was returned from MySQL:<BR>";
echo mysql_error();
exit;
}
if (mysql_num_rows($queryResult)==0)
{
echo "No phones were found please try again.";
}
else
{
while ($dbRecord=mysql_fetch_array($queryResult))
{
echo "Phones Found: ".$dbRecord["make"].", ".$dbRecord["model"].", ".$dbRecord["camera"].", ".$dbRecord["bluetooth"]."<BR>";
}
}
?>