I have put the search code below that I am using, it currently searches for the beginning of a postcode in a mysql field.
However the data added to the mysql database originated in an access database where the full postcode was shown ie: AA11 1AA. This was manually altered to strip the second part of the postcode off for confidentiality reasons. The Access database has since become very active with a lot of new entries and updates. What I would like to do is import the full postcode in future, means an easy automated process, and modify the search.
The search is allowed to have 4 characters on the input screen as a maximum, what I need to do is 1:add a space on the end of the input postcode 2:search and output only matching results for the input postcode AND space. ie inputting AA1 should not give results of all AA1 AND AA11 entries which a standard search and match would...
Can anyone point me to some code snippets or samples that would help me in this?
All replies welcomed, even if it is only to abuse me!
Code:
$sql = "select * from aromaol where town = '".$_POST['seek']."' or postcode = '". $_POST['seek'] ."'";
$result = mysql_query($sql,$conn)or die (mysql_error());
if (mysql_num_rows($result)==0){
echo "No Match Found";
}else{
while ($row = mysql_fetch_assoc($result)){
echo "Name: " .$row['forename']." ".$row["surname"]."<br>";
echo "".$row["town"]."<br>";
echo "Tel No: ".$row['telno']."";
echo " Mobile No: ".$row["mobno"]."<br>";
echo "Link: <a href=\"[URL unfurl="true"]http://".$row[/URL]['weblink']."\">Visit their webpage</a><br><br>";
However the data added to the mysql database originated in an access database where the full postcode was shown ie: AA11 1AA. This was manually altered to strip the second part of the postcode off for confidentiality reasons. The Access database has since become very active with a lot of new entries and updates. What I would like to do is import the full postcode in future, means an easy automated process, and modify the search.
The search is allowed to have 4 characters on the input screen as a maximum, what I need to do is 1:add a space on the end of the input postcode 2:search and output only matching results for the input postcode AND space. ie inputting AA1 should not give results of all AA1 AND AA11 entries which a standard search and match would...
Can anyone point me to some code snippets or samples that would help me in this?
All replies welcomed, even if it is only to abuse me!