Searching My Database

From: Date: Wed, 29 Sep 2004 07:14:49 +0000
Subject: Searching My Database
Groups: php.general 
Request: Send a blank email to php-general+get-198160@lists.php.net to get a copy of this message
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 WHERE Work_Permit_Rqd LIKE '$WorkPermit' But 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. -- ----------------------------- Michael Mason Arras People www.arraspeople.co.uk -----------------------------

« previous php.general (#198160) next »