Results 1 to 4 of 4

Thread: More search help

  1. #1
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default More search help

    Ok, so I've come up with a way I could possibly do my search bar which would involve selecting all records from the database each time, and then going through those records with preg_match to find a regular pattern and find the record that way.

    Of course, that would be very inefficient, so I was hoping there was some way in MySQL you can do: "SELECT * FROM column WHERE column5 = '$search'" At the moment, this would only returnexact matches, which is what I don't want. I want there to be a little flexibility so that if there's a record with the value "Address 50" I want the user to just be able to search 50 and it come up, not have to type the exact value every time. How could I go about doing this? Would it be very complicated?

  2. #2
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    try:
    "SELECT * FROM column WHERE column5 LIKE '$search'"

    more info here
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  3. The Following User Says Thank You to Master_script_maker For This Useful Post:

    Schmoopy (02-19-2009)

  4. #3
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Ahh, what a useful select clause

    Thanks.

  5. #4
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    You're Welcome
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •