Maybe what you want is 

if (isset($_POST['WorkPermit'])) {
        $WorkPermit = $_POST['WorkPermit'];
        // do the select statement
} else
        echo "<p>no search</p>";
}


-----Original Message-----
From: Harlequin [mailto:[EMAIL PROTECTED]
Sent: 29 September 2004 08:15
To: [EMAIL PROTECTED]
Subject: [PHP] Searching My Database


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
----------------------------- 

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


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

DDB London - Effectiveness Agency of the Year
DDB Worldwide - Global Network of the Year

The Information given in the above email 
and / or attachment is provided without warranty of
any kind, either expressed or implied on the part 
of the writer or the Agency.

______________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

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

Reply via email to