Re: [PHP-DB] mysql exclusion in php

2002-05-30 Thread Ed Gorski

You need to parse the string and PHP and generate the appropriate query 
based on that parsing...

ed

At 09:22 PM 5/29/2002 -0700, Chris Payne wrote:
Hi there everyone,

How can I do a search which excludes certain words if they put a - in the 
search string?  I can do a search easily, but if they put a - infront of a 
word in the string, how can I then get MySQL to search all entries EXCEPT 
where the word with a - next to it appears?

Thanks for everything.

Chris


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] mysql exclusion in php

2002-05-29 Thread Chris Payne

Hi there everyone,

How can I do a search which excludes certain words if they put a - in the search 
string?  I can do a search easily, but if they put a - infront of a word in the 
string, how can I then get MySQL to search all entries EXCEPT where the word with a - 
next to it appears?

Thanks for everything.

Chris



RE: [PHP-DB] mysql exclusion in php

2002-05-29 Thread Beau Lebens

chris, you'll need to do a little PHP manipulation, perhaps (pseudo)

if -word. (regular expression?)
for each -word
SQL .=  NOT LIKE '%word% AND'
endforeach
endif
for each other word
SQL .=  LIKE '%word%' AND
endforeach

strip trailing AND

clean up SQL as required

query db

-
ok, obviously that's very rough, but i think something like that will work
:)

HTH

Beau




// -Original Message-
// From: Chris Payne [mailto:[EMAIL PROTECTED]]
// Sent: Thursday, 30 May 2002 12:22 PM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] mysql exclusion in php
// 
// 
// Hi there everyone,
// 
// How can I do a search which excludes certain words if they 
// put a - in the search string?  I can do a search easily, but 
// if they put a - infront of a word in the string, how can I 
// then get MySQL to search all entries EXCEPT where the word 
// with a - next to it appears?
// 
// Thanks for everything.
// 
// Chris
// 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php