Re: Searching My Database
| From: | Silvio Porcellana | Date: | Wed, 29 Sep 2004 10:08:06 +0000 |
| Subject: | Re: Searching My Database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198172@lists.php.net to get a copy of this message | ||
I don't think this is the best list to ask questions about SQL, try http://lists.mysql.com
Cheers!
Silvio Porcellana
Harlequin wrote:
Morning everyone. I've read around the subject of searching and although using the FULLTEXT capability of MySQL might be the proper way of doing this I feel it's somewhat limited and have decided to use a simple select procedure. I'm sure there's a better way of doing this, as I'm quite new to MySQL and even newer to searches, However - here's my conundrum: I'm declaring variables at the top of my query like so:Code: $WorkPermit == '" . $_POST["WorkPermit"] . "';And then execute the query like so:Code: SELECT * FROM MembersData WHEREBut I have many other fields that the searcher can use. What do I do if they leave this field blank...? I appreciate that I should be using the MATCH function but I'm not entirely happy with the way it searches. What I need to do is actually omit a field (s) from the search if the value the searcher submitted was NULL. For example: Search field X and Y and Z and if x or Y are null continue... Am I explaining this OK...? Any suggestions gratefully received.Work_Permit_RqdLIKE '$WorkPermit'