Solved

php Search

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mysql ide 10 40
How can I enable / disable a text box with a checkbox 3 18
If condition on Html with Asp 11 17
Present Absent from working date rage 11 20
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

772 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