1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Mexico DF Mexico
    Rep Power
    Hi thanx 4 reading.

    Hi have a site, its like yellowpages, so when someone adds his url the the database it has a field to set key words like altavista and other search engines, now, the field in MySQL its like BLOB (I dont thik that matters) in the main page I have the search box, and the results page Im using where field LIKE '%$seachbox%' is that fine? the problem is that I search a word it finds results, but if I search for more than 2 words it doesent finds nothing, Im using the get method in the search for to pass the values in the string and looks fine "results.php?key=cars+red" but it doesent find nothing eaven if there exist a content in the keyword field with the two words "cars" and "red" if I search "car" the result is given fine.... the problem here is the fact that im trying to search more than one word.

    Ill apreciate the help.

    Luis Tena
    Mexico DF.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 1999
    Rep Power
    I am not familiar with MySQL but this is a untested bit of script.

    $array = explode(" ",$inputText);

    $query = "select * from table where ";

    $and = 0;
    for ($i=0; $i < sizeof($array); $i++) {
    if ( $and > 0 ) { $query .= "and "; }

    $query .= "fieldName = '%".$array[$i]."%'";

    It builds up the select statement, but looking at it now I don't know whether it would work. Try it, perhaps you could modify.

    Hope this is of some help.


Similar Threads

  1. Frames hijacked after remote search
    By Telejoke in forum Antivirus Protection
    Replies: 2
    Last Post: September 26th, 2007, 09:32 AM
  2. Replies: 4
    Last Post: February 13th, 2005, 11:58 PM
  3. Cgi Search feature script
    By butsy_7 in forum Perl Programming
    Replies: 5
    Last Post: January 22nd, 2004, 07:43 PM
  4. Is there any alternative to fulltext search?
    By irishairpics in forum MySQL Help
    Replies: 2
    Last Post: December 10th, 2003, 02:40 PM
  5. Site html search with php?
    By stojan in forum PHP Development
    Replies: 1
    Last Post: November 17th, 2003, 09:20 PM

IMN logo majestic logo threadwatch logo seochat tools logo