Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199903

[PHP3] 2 words search From: Valerio Fioretti (fioretti <email protected>)
Date: 03/28/99

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>