Re: PHP/MySQL Search Engine Query Question

2002-07-28 Thread Serge Paquin

This is more of a php question.  explode $string on " " (space) which will
give you an array.  Loop through the array first with $sql.="WHERE
whatevercolumn LIKE '%$val%'" then for every other entry change WHERE to
AND.

Serge.

- Original Message -
From: "Paul Maine" <[EMAIL PROTECTED]>
To: "MySQL MySQL" <[EMAIL PROTECTED]>
Sent: Saturday, July 27, 2002 10:32 PM
Subject: PHP/MySQL Search Engine Query Question


> I am currently working on a website that is implemented using PHP and
MySQL.
>
> The site currently has a simple search engine that allows a shopper to
type
> in a search string that is stored in $search. For example, if a shopper
> types in 1972 Ford Mustang
> $string ="1972 Ford Mustang"
>
> Using the following SQL statement:
> SELECT * FROM whatevertable WHERE whatevercolumn LIKE '%$search%
>
> Records are returned that have this exact string and in this exact order
> (I'm aware a wild card character is included on the front and back of the
> string).
>
> My desire is to be able to logically AND each token of the search together
> independent or the order of the tokens.
> I want to return all records that have Mustang AND 1972 AND Ford.
>
> Since a shopper inputs the search string in advance I don't know how many
> tokens will be used.
>
> I would appreciate any suggestions.
>
> Regards,
> Paul
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: PHP/MySQL Search Engine Query Question

2002-07-28 Thread Dicky Wahyu Purnomo

Pada Sat, 27 Jul 2002 21:32:48 -0500
"Paul Maine" <[EMAIL PROTECTED]> menulis :

> $string ="1972 Ford Mustang"
> 
> Using the following SQL statement:
> SELECT * FROM whatevertable WHERE whatevercolumn LIKE '%$search%

> I want to return all records that have Mustang AND 1972 AND Ford.

my suggestion :
change your script into this one :

select * from whatevertable where $string;

$string="whatevercolumns like \"%1972%\" and whatevercolumns like \"%Ford%\" and 
whatevercolumns like \"%1972%\" "

or you can try this  :
$query="1972 Ford Mustang"
$query=ereg_replace(" ","%\" and whatevercolumns like \"%",$query);
$string="whatevercolumns like \"%$query%\"";

select * from whatevertable where $string;

-- 
Write clearly - don't be too clever.
- The Elements of Programming Style (Kernighan & Plaugher)
 
MySQL 3.23.51 : up 37 days, Queries : 353.647 per second (avg).

--
Dicky Wahyu Purnomo - System Administrator
PT FIRSTWAP : Jl Kapt. Tendean No. 34 - Jakarta Selatan (12790)
Phone : +62 21 79199577 - Web : http://1rstwap.com


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




PHP/MySQL Search Engine Query Question

2002-07-27 Thread Paul Maine

I am currently working on a website that is implemented using PHP and MySQL.

The site currently has a simple search engine that allows a shopper to type
in a search string that is stored in $search. For example, if a shopper
types in 1972 Ford Mustang
$string ="1972 Ford Mustang"

Using the following SQL statement:
SELECT * FROM whatevertable WHERE whatevercolumn LIKE '%$search%

Records are returned that have this exact string and in this exact order
(I'm aware a wild card character is included on the front and back of the
string).

My desire is to be able to logically AND each token of the search together
independent or the order of the tokens.
I want to return all records that have Mustang AND 1972 AND Ford.

Since a shopper inputs the search string in advance I don't know how many
tokens will be used.

I would appreciate any suggestions.

Regards,
Paul

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Search Engine Query

2001-07-11 Thread Werner Stuerenburg

I don't know if I understand your question, but you may want to

SELECT * FROM table
WHERE fieldname LIKE '%searchterm%'

Also, search at mysql.com for FULLTEXT in
http://www.mysql.com/doc/C/R/CREATE_TABLE.html
and learn what you can do with this and when this will be good.

Sie schrieben am Mittwoch, 11. Juli 2001, 19:04:42:

> Hi List,
> Can anyone tell me how do i create a search engine 
> query.?
> I am new to Mysql and know how to use a simple 
> select * from "" where "" = "";
> but what about if I need to 
> create a query for a search engine that looks for Every word.

> Thanks in Advance 
> Pradeep Dsouza

> (Aspbyte Creations)
> 
>
>   This Email was sent by Pradeep Dsouza.
> 
>
> Mail Me at : [EMAIL PROTECTED]
>  : [EMAIL PROTECTED]
> Telephone : -091 - 022 - 7573097
> Address :
> RH-04 E-11 Sector -09
> CBD Navi Mumbai
> Maharashtra India.
> Visit Aspbyte Online at :
> Website:www.aspbytecreations.com
> Re:
> If you recieved this mail in Error please bounce the mail.
> 
>


-- 
Herzlich
Werner Stuerenburg

_
ISIS Verlag, Teut 3, D-32683 Barntrup-Alverdissen
Tel 0(049) 5224-997 407 ยท Fax 0(049) 5224-997 409
http://pferdezeitung.de



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Search Engine Query

2001-07-11 Thread Pradeep Dsouza

Hi List,
Can anyone tell me how do i create a search engine 
query.?
I am new to Mysql and know how to use a simple 
select * from "" where "" = "";
but what about if I need to 
create a query for a search engine that looks for Every word.

Thanks in Advance 
Pradeep Dsouza

(Aspbyte Creations)

  This Email was sent by Pradeep Dsouza.

Mail Me at : [EMAIL PROTECTED]
 : [EMAIL PROTECTED]
Telephone : -091 - 022 - 7573097
Address :
RH-04 E-11 Sector -09
CBD Navi Mumbai
Maharashtra India.
Visit Aspbyte Online at :
Website:www.aspbytecreations.com
Re:
If you recieved this mail in Error please bounce the mail.