Hi all.
I have built a database where the user inputs a postcode (split over two parts) and gets infromation returned.
What I would like to do is write a select statement that only extracts the first digit of the input data for the value used in the query, ie
User inputs - 4BU
The query searches on the value 4.
i have put together the following but it doen't appear to work to well (the value in question is variable $pc2).
Or am I barking up the wrong tree - is this an action that should take place earlier?
Thanks for reading.
I have built a database where the user inputs a postcode (split over two parts) and gets infromation returned.
What I would like to do is write a select statement that only extracts the first digit of the input data for the value used in the query, ie
User inputs - 4BU
The query searches on the value 4.
i have put together the following but it doen't appear to work to well (the value in question is variable $pc2).
Code:
$query = "SELECT
DISTINCT location.postalcode,
location.postal,
venue.VenueType,
venue.Name
FROM
location LEFT JOIN venue
ON location.RegionCode = venue.RegionCode
WHERE
location.postalcode = '$pc1' AND
location.postal = ('$pc2'+1) AND
venue.VenueType = '$pc3'";
Or am I barking up the wrong tree - is this an action that should take place earlier?
Thanks for reading.