Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

php Search

Posted on 2012-03-27
3
Medium Priority
?
377 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 1000 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 111

Accepted Solution

by:
Ray Paseur earned 1000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In this article, we’ll look at how to deploy ProxySQL.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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)
Suggested Courses

618 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