/    Sign up×
Community /Pin to ProfileBookmark

filter results by location

Looking to add a list of Music Teachers to website that could be searched by someone looking for a teacher by specific options…..
Example: Search by postal code and by instrument taught, etc.
This way someone could search for the closest piano teacher to where they live for example.
Does anyone know of any scripts etc. that could help with this?

Thanks ?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@speghettiCodeJan 11.2013 — You might receive better answers if you could include more detail in your question (i.e. what information, code, etc. you already have).

If you have a database table set up...something with a column for each search criteria, for example, then you could use a simple SQL query to extract the rows containing the Teachers you need. For example:

[CODE]
$instrument='drum';//or whatever valid input you received from the user's search
$postalCode='12345';//or whatever valid input you received from the user's search
mysql_query("SELECT teachers.* FROM teachers WHERE instrument='$instrument' AND postalCode='$postalCode'");
[/CODE]


BE SURE TO CLEAN YOUR VARIABLES (i.e. use htmlentities($instrument,ENT_QUOTES, 'utf-8') ) before using the variable in your SQL to prevent SQL injection attacks.

Alternately, you could select all teachers from the database or in an array and loop through the array extracting the information which meets the user's search criteria. While this approach is probably less likely to be a threat to your database, it is resource intensive.
Copy linkTweet thisAlerts:
@CaptainkewlauthorJan 23.2013 — Thanks for the reply. I was looking for a pre-existing script that I could use / modify.
×

Success!

Help @Captainkewl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...