Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

PHP/SQL search form: how do I make it ignore white space, order, and c


  • Please log in to reply

#1
jaffacake

jaffacake

    Member

  • Member
  • PipPip
  • 40 posts

Hi,

 

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...
 


  • 0

Advertisements







Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP