Re: Need some ideas

From: Date: Fri, 17 Nov 2000 12:12:13 +0000
Subject: Re: Need some ideas
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-4507@lists.php.net to get a copy of this message
Another way you might do this is by constructing a "LIKE" parameters. say we have this: $search = "my lovely dog"; You could use the tokenizing and loops and such to create this: select * from table where column like '%my%' and column like '%lovely%' and column like '%dog%'; The advantage of this way is that "my", "lovely" and "dog" can occur in any order. I don't know offhand what the processing overhead would be, so you might very well disregard this. "Joseph Stein" <joes@teleport.com> wrote in message news:5.0.0.25.0.20001111210315.02d93710@mail.teleport.com... > I have been working on "upgrading" the search capability on my MySQL database. > > Currently, I do an oversimplified search applied to multiple fields of the > database using a really ugly SELECT statement that matches on the verbatim > $search from the form. > > What I want to do, (that won't simplify the select statement much), is to > take a search string and tokenize it, and do several independant searches > into temporary database(s) and pull the final results out of the > last-created temporary database -- but am a little lost. > > I think that this is what I want to do: > > form is POSTed > tokenize $search > if this is the first time through the loop > create a temporary database with results from the first token of the > search string > if this is an AND search > continue creating temporary databases from the first temp database > else > continue adding to the first temporary database > > but I am unsure, based on information in the online manual about > strtok(). Would using split() and the array-walking functions be better > suited to this? Any ideas, anyone? > > FWIW, I am using PHP4.0.3pl1 with Apache 1.3.14 and MySQL 3.23.26-beta. > > Thanks in advance for any help. > > joe > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#4507) next »