I'm trying to build a search form that pulls data from a database, but I'm completely new in the world of PHP and SQL. I know HTML, but only the very basics of PHP. I'm trying to teach myself PHP and SQL through books and tutorials, but I hit a point where I don't know how to solve my problem.
So far, I have a site with 6 search boxes and a small SQL database (designed in phpmyadmin), and a lot of PHP code. It took me a while to figure it out, but I still feel pretty clueless about the whole PHP/SQL thing. I got it to work, but I realized that it only gets the right results if the user follows pretty strict rules when entering the search term. For example, if the user enters an umimportant word like "the" or "and" that's not in my database, it ignores the (important) rest and doesn't come up with any results. Is there any way to make it ignore certain words like that and still come up with results if the rest matches?
Also, is there a way to make it ignore punctuation, word order, and white space? For example, if my search box looks for an author, and my database entry is "Edgar Allan Poe", I want it to find this result even if someone fills the search box with:
- "Poe Edgar Allan"
- "Edgar Poe"
- "Edgar, Allan Poe"
(or another variation)
I don't really understand uasort(), and I haven't been able to figure out how I would use a search server (without any costs).Could anybody tell me what I can do? My search form seems pretty useless as it is right now...