Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4

Thread: Searching?

  1. #1
    Senior Member tekp's Avatar
    Join Date
    Jan 2004
    Location
    A small village near a small city near a small cit
    Posts
    918
    Member #
    4667
    Liked
    1 times
    I've been wondering for a while now how search engines work, the ones on individual sites, as opposed to web searches (google, for example).

    Is there a specific SQL command to select data from a table that roughly matches a string? Or would you have to extract the data piece by piece and compare it manually using PHP?

    Or does it not use sql/php at all...?

    Just wondering, as it's bugging me.
    tekp :cheeky: tekponline.com

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    There is the LIKE command..
    http://www.htmlite.com/mysql011.php

    Or there is the FULLTEXT command

    http://www.phpfreaks.com/tutorials/129/0.php

    A sample query I have on a page using like is
    PHP Code:
    $query "SELECT * FROM pages WHERE (title LIKE '%".$v."%' OR title LIKE '".$v."%' OR title LIKE '%".$v."')"
    The first WHERE means where $v is in the column, the second means where the column starts with $v and the last means when the column ends with $v

    Hope this helps.

  4. #3
    Senior Member
    Join Date
    Jul 2005
    Location
    S.Wales, UK
    Posts
    250
    Member #
    10742
    Or you could build the sql statement on the fly.

    eg if they enter:
    flowers AND pots OR weeds

    Then you iterate through the text and build the SQL with appropriate LIKE statements seperated by AND OR etc.
    Paul Creedy
    Visit my community site at: www.rhonddacynontaff.com
    My hosting: www.rcthosting.com
    My Content Management product: www.dynamiccontenteditor.com

  5. #4
    Senior Member tekp's Avatar
    Join Date
    Jan 2004
    Location
    A small village near a small city near a small cit
    Posts
    918
    Member #
    4667
    Liked
    1 times
    Thanks for the response, I'll check out the links when I have more time.

    Thanks again
    tekp :cheeky: tekponline.com


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:09 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com