Does anyone know how I might adjust something like this to allow users to search a database for partial postcodes (eg LA4 instead of the full 6 or 7 characters)?
if ($location ==("searchpostcode")) {
$query = ("SELECT * FROM propertys WHERE MATCH(Postcode) AGAINST ('$postcode')");
$result = mysql_query($query);
// see if any rows were returned
if (mysql_num_rows($result) > 0) {
// yes
// print them one after another
echo "<table cellpadding=10 border=1>";
while($row = mysql_fetch_row($result)) {
echo "<tr>";
echo "<td>".$row[0]."</td>";
echo "<td>" . $row[1]."</td>";
echo "<td>".$row[2]."</td>";
echo "</tr>";
}
echo "</table>";
}
else {
// no
// print status message
echo "No records found!";
}
}