hi all
I am in need to create a 'basic' search engine. There are 4 inputs which could narrow the search, these are:
$_WhiteName, $_BlackName, $_Result and $_Tourn

I need to check if the user is looking for all the games:
-in the database (meaning all fields are empty)
-of a specific player (meaning both fields [$_WhiteName and $_BlackName] have the near same value
-of a specific tournament ($_WhiteName AND $_BlackName are empty but $_Tourn is not)
-Won/Lost/Drawn of a specific player ($_White/$_Black Name with near same value, $_Tourn empty but $_Result not)
-Won/Lost/Drawn of a specific player in a specific tournament ($_White/$_Black Name with near same value, $_Tourn and $_Result not empty)

1. So I thought constructing the query sentence based on a bunch of IFs and then simply echo everything the Database returns (already filtered by the query)
What do you think about this idea?

2. I tried a test sentence:
SELECT * FROM BiblioPartidas WHERE WhiteName LIKE $_WhiteName AND BlackName NOT LIKE $_WhiteName
but it returned rows where $_WhiteName is equal to BlackName so im a bit lost here...
How would I write a correct sentence defining such criterias?