|
Posted by leader on 05/19/07 04:27
On Fri, 18 May 2007 18:04:25 GMT, "cluthz" <WHATEEVVEERR@by.co.uk>
wrote:
>Hi there,
>
>I have a php / mysql application where I have to change the mysql postcode
>field from being one field to two fields (for the first page and second part
>of the post code).
>
>In the database abuot 80% of fields have been entered in a good format
>having a space between the two sections.
>
>I'm going to write a script that will search for this space and divide all
>existing postcodes at the the point where this space occurs. Where there is
>no space in a postcode field. I'm just going to cut the postcode at the
>fourth character. Therefore anything past the fourth character will go into
>the second part of the field.
>
>I thought before i go implementing this. Maybe someone has done it already,
>or even knows of a webservice or something that exists that will do it with
>better accuracy then I can.
>
>A list of all valid postcodes (first part) would be useful for example as I
>could compare each postcode to this list.
>
>Any suggestions most welcome.
>
>Thanks in advance
>
One of the gurus around here, some months ago, turned out to be an
expert in all this; your hope must be he reads your post (and mine!).
I'm having my own problems with the UK postcodes at present and might
add a couple of pointers -
1 - keep in mind that some (Central London only) postcodes can stretch
to, say, SW1A 1AA, and -
2 - some cities (Birmingham, Glasgow, Manchester, Liverpool,
Sheffield) have just the one starting letter (which can mess up your
sorts - G1 1AA, G41 1AA, etc).
As for your list, go see -
http://www.postcode-ads.co.uk/s/index.htm
Presumably the splitting is a prelude to sorts of all kinds. Unless
you stick a [space] before any single-digit area (e.g. convert G1 1AA
to G 1 1AA) you'll have more problems. I suggest you might avoid
problems in the future by manipulating any new input, adding spaces
appropriately.
Navigation:
[Reply to this message]
|