Welcome Guest, Not a member yet? Register   Sign In
How does facebook (and myspace) do this....?
#1

[eluser]flyenig[/eluser]
When you register on facebook or myspace, or u go to settings and u want to select your school,
They use a jquery autocomplete that has a list of every school.

Or when you want to select a city, and you start typing your city, the autocomplete shows up with the cities.

Are they storing all the cities, schools, countries, etc in a Database or are they getting it from some kind of API or something?

becasue im trying to implement something like this in my project.


Thanks Smile
#2

[eluser]richthegeek[/eluser]
The cities and so on are stored in a database, but the database is populated by past users. That is, when you can't find your school, you just type it in and it "creates" it.

Then when the next person from your school types in the name, your result shows up.

The way this isn't abused is because each user has a limited number of slots in which to provide spam, or expletives, or similar, and so when there are 100+ users for a valid result, they quickly outweigh the bad results.

For actually matching what you typed in, check out MySQL's LIKE and PHP's levenshtein function.
#3

[eluser]flyenig[/eluser]
yea thats what i was thinking, thanks for the info




Theme © iAndrew 2016 - Forum software by © MyBB