PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 28th, 2012, 06:31 AM
ianhaney ianhaney is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 91 ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 15 h 23 sec
Reputation Power: 11
PHP-General - Return mysql database results dependent on town entered

Hi

I am bit stuck, I want to return results from a mysql database when a user enters their town or postcode in for example below

they enter in their town or post code and a list of area managers is displayed closest to their town or postcode along with their contact number

Is that possible

Thank you

Ian

Reply With Quote
  #2  
Old December 28th, 2012, 09:09 AM
EEsterling EEsterling is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2011
Posts: 97 EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level)EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level)EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level)EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level)EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level)EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 18 h 28 m 56 sec
Reputation Power: 49
Not only possible, pretty standard stuff.

Your description is too vague to say more.

Reply With Quote
  #3  
Old December 28th, 2012, 09:13 AM
ianhaney ianhaney is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 91 ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 15 h 23 sec
Reputation Power: 11
Hi EEsterling

Thank you for the reply

For example I have entered two records in a mysql database

and on the php page I have a text field called town and the user enters their town in and I want the php to display results matching that town name or close to that town name if there is no match for that town name

Reply With Quote
  #4  
Old December 28th, 2012, 10:35 AM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Click here for more information.
 
Join Date: Dec 2004
Posts: 7,931 E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 7 h 48 m 54 sec
Reputation Power: 7053
Actually what you want to do is completely clear, the technical details of your system are the vague part.

For example: what location data do you store for your managers - if the store the post code and town name, then you can perform a simple equals select query to fetch a list of managers belonging to that post code or town. If you store one but not the other, then you're going to need a database of locations so that you can map between them.

The part about fetching nearby results (that don't match the post code or town name exactly) is more complicated. In order to do this, you need a database the maps post codes and town names to lat/long coordinates. Then when the user enters a post code or town name, you look up its lat/long and then perform a radius search around it to locate other post codes / town names within that area. Modern versions of MySQL have built-in support for performing a spatial search like this.
__________________
PHP FAQ
How to program a basic, secure login system using PHP

Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
  #5  
Old December 28th, 2012, 10:36 AM
ianhaney ianhaney is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 91 ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level)ianhaney User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 15 h 23 sec
Reputation Power: 11
I will be storing the town name but can store the post code as well if it is easier than just storing the town name

Reply With Quote
  #6  
Old December 28th, 2012, 10:48 AM
aeternus's Avatar
aeternus aeternus is offline
For POny!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Location: Amsterdam
Posts: 416 aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level)aeternus User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 4 h 56 m 43 sec
Reputation Power: 114
edit: never mind I misread the question
__________________
PHP Tutorial

Last edited by aeternus : December 28th, 2012 at 10:53 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP-General - Return mysql database results dependent on town entered

Developer Shed Advertisers and Affiliates



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap