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