To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Coding

Coding Help with PHP coding

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 10-09-2006, 02:20 PM   #1
essexboyracer
Member
 
Join Date: Jun 2001
Location: UK
Posts: 51
UK Postcode Sort / Group

Hi All, I have one mysql table that inserts sent data, name, address, full UK postcode. They want to pull out daily results that are near to their locale, select on a limit of LIMIT 150. They dont want to do this by specifying a radius, but instead by specifying the out postcode, like CO or LU or LE etc... they would then need the result sorted on rank - nearest first, furthest last

Would i have to get php/mysql to give each postcode a ranking on insertion, based on a regexp match on the first 1/2 charccters of the code, or is there a better mysql query that will work?

Vague - yes. Any takers?
essexboyracer is offline   Reply With Quote
Old 10-09-2006, 04:01 PM   #2
essexboyracer
Member
 
Join Date: Jun 2001
Location: UK
Posts: 51
Hi All, edited this as I had a thought. A better way to do this is;

1. Strip the UK postcode down to the first 1 or 2 letters
2. Match that string against an 'exclude' list, e.g. pseudo code

Code:
    if ($record = 'HP' OR 'AL' OR 'LU') {
     $update = mysql_query("UPDATE proposer SET outcode = '1'");
    }

    if ($record = 'OX' OR 'NN' OR 'CB') {
     $update = mysql_query("UPDATE proposer SET outcode = '2'");
    }
and so on.

3. Then when It comes to extract info, all I need to do is order on the new outcode field?

Therefore the question would be what would I construct as the regexp initially in step 1? I have the following;

http://www.govtalk.gov.uk/gdsc/html/frames/PostCode.htm

and as well as a regexp, from the same site

http://www.govtalk.gov.uk/gdsc/schem...stCodeType.htm

Any ideas? im stil playing
essexboyracer is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 07:43 AM.








Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.