Solved

php Search

Posted on 2012-03-27
3
353 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 110

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

733 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