Website Search Bar Code

Discussion in 'PHP' started by zeninho, Jun 3, 2011.

  1. #1
    Hello world,

    does anyone have php code for search bar? it would really help!!

    or can you give me some heads up or link where can i learn it step by step?

    Thank you for your time and help, i appreciate it
     
    zeninho, Jun 3, 2011 IP
  2. MarPlo

    MarPlo Member

    Messages:
    97
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    48
    #2
    Hy,
    Try use sphider searchengine, it's free, you can find it on the net.
     
    MarPlo, Jun 4, 2011 IP
  3. TSelbeck

    TSelbeck Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    There isn't really much to it. You have a regular form, with a search field and the submit button.

    - Upon submitting, you use $_GET[] or $_POST[] (whichever you're using) to get the value of the submitted search box
    - Sanitize the input
    - Query database using LIKE instead of =
    - Show results

    The database query may look like..

    SELECT * from `users` WHERE `name` LIKE '%$search_string%' 
    Code (markup):
     
    TSelbeck, Jun 5, 2011 IP