Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
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