php3-list | 199903
Date: 03/28/99
- Next message: Rasmus Lerdorf: "Re: [PHP3] Other considerations (was Re: [PHP3] File vs blob?)"
- Previous message: Rasmus Lerdorf: "Re: [PHP3] Parse error"
- Next in thread: Adam Gotheridge: "Re: [PHP3] 2 words search"
- Reply: Adam Gotheridge: "Re: [PHP3] 2 words search"
- Reply: jkraai: "Re: [PHP3] 2 words search"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello, I have a problem with a query. I'd like to make a search in a
table inserting 2 or more words in the input form, using the OR.
Everything works fine with 1 word but with more I obtain result only for
the LAST inserted one.
WHY ?
How can I build it? This is my code:
$words = explode (" ", $search);
$num = COUNT ($words);
WHILE ($n < $num):
$query = "SELECT * FROM newsWHERE (title LIKE '%$words[$n]%') OR (text
LIKE '%$words[$n]%')ORDER BY id DESC";
$result = MYSQL_QUERY($query);
$n++;
ENDWHILE;
Thanks!
Valerio
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev-list-admin <email protected>
- Next message: Rasmus Lerdorf: "Re: [PHP3] Other considerations (was Re: [PHP3] File vs blob?)"
- Previous message: Rasmus Lerdorf: "Re: [PHP3] Parse error"
- Next in thread: Adam Gotheridge: "Re: [PHP3] 2 words search"
- Reply: Adam Gotheridge: "Re: [PHP3] 2 words search"
- Reply: jkraai: "Re: [PHP3] 2 words search"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

