Solved

php Search

Posted on 2012-03-27
3
347 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 109

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP alternative to file_get_contents('php://input') 4 61
Log in through ID 5 17
PHP: Best way to scan folders and process files 10 39
JQuery Search Filter 2 29
Creating and Managing Databases with phpMyAdmin in cPanel.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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 how to count occurrences of each item in an array.

856 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