Reputation: 211
I'm trying to make a program that search three words out of three columns. This is my search input, but I think it is not the right way to make it.
<form action="resultaat.php" method="post">
<b>Typ Postcode:</b> <input type="text" name="term" />
<b>Typ Huisnummer:</b> <input type="text" name="term2" />
<b>Typ Toevoeging:</b> <input type="text" name="term3" />
<input type="submit" name="submit" value="Zoek" />
</form>
And this is my sql code:
mysql_connect ("localhost", "root","") or die (mysql_error());
mysql_select_db ("inboedelmeter");
$term = $_POST['term'];
$term2= $_POST['term2'];
$term3 = $_POST['term3'];
$sql = mysql_query("select * from inboedelwaarde_adres where Postcode like '$term' and Huisnummer like '$term2' and Toevoeging like '$term3'");
It seems for me like the right way, but it does not work.. Can anybody help me with this? Thanks!
Upvotes: 1
Views: 74
Reputation: 10147
If you want to do an exact search,
$sql = mysql_query("select * from inboedelwaarde_adres where Postcode
= '$term' and Huisnummer ='$term2' and Toevoeging = '$term3'");
Upvotes: 1