Solved

php Search

Posted on 2012-03-27
3
328 Views
Last Modified: 2012-04-13
Hello,

I just want to ask how difficult it is to make a search using php ...


for example , for a dating site it it should return the people that are in the given city and the the people who live 5 km away form that given city .

is it difficult to make ? is there any tutorial for it or ...

thank you
0
Comment
Question by:kensy11
  • 2
3 Comments
 
LVL 14

Expert Comment

by:EMB01
ID: 37772806
This would depend on how your database is set up.  Let's say it's set up like this:

Persons_table:
int ID
varchar Name
varchar City

You would make an SQL call with PHP like this:

$q = 'select `Name` from `Persons_table` where `City` = "Canton"';
mysql_query($q);

To get people within 5 miles of that city, you would have to find what cities are within 5 miles of that city.  To do this, you might need to have a zip code for your user.  See this application for an example of how it might work:

http://www.zip-codes.com/zip-code-radius-finder.asp?zipMilesLow=5&zipMilesHigh=5&zip1=44714&Submit=Search
0
 
LVL 14

Assisted Solution

by:EMB01
EMB01 earned 250 total points
ID: 37772814
Here is another way to do this.  From the link below:

"you ask the user for his address and then request google maps api for the longtitude and latitude"

Ref.  http://stackoverflow.com/questions/5552502/find-people-within-x-miles-of-my-city
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 250 total points
ID: 37774052
This article teaches how to do proximity matching.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_4276-What-is-near-me-Proximity-calculations-using-PHP-and-MySQL.html

Be careful if you use Google APIs for any of the application.  You are required to put the site online for free use by everyone if you do not have a Google Enterprise license for their services.  If you use the Google Maps API or the Google Geocoder, you must display a Google map with the information.

So the answer to the question "Is it difficult?" is "Not if you have enough money!"
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now