infinitus Junior Poster in Training

Hello there i would like someone to have a peek at this code and does it solve the question correctly ?? Are there any mistakes or any improvements i could add ??

Question 3.
Write a script to search for the properties which match a postcode (call it search.php ). Use SQL search. You will need an HTML form which allows the user to type a postcode they are searching for.


<form action="properties.php" method="post"> 
Postcode: <input type="text" name="postcode" />
<input type="submit" />
$con = mysql_connect("localhost","maciej","kupadupa1"); // sql database server/ username/ password
if (!$con) // if unable to access database 
  die('Could not connect: ' . mysql_error()); //throw this error

mysql_select_db("properties", $con); // select my database "properties" 
// select from properties row postcode where postcode = user type data
$result = mysql_query("SELECT * FROM properties 
WHERE postcode='$_POST['postcode'];'");

while($row = mysql_fetch_array($result)) // when found display data
  echo $row['postcode']; // display all matching post codes
  echo "<br />";