the way I'd do it is " ... WHERE lastname LIKE '$last_name%" AND firstname
LIKE "$first_name%"

this gets round the problem of blank first names and treats all names as
being the start of a name, e.g. "Smith" will find "Smithson", but because of
your ORDER BY, for an exact imnput, an exact match will always show first.
haven't tried this at all but seems sound sql.

        Tim Ward
        Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html


> -----Original Message-----
> From: Jerry Lake [mailto:[EMAIL PROTECTED]]
> Sent: 05 April 2001 22:23
> To: [EMAIL PROTECTED]
> Subject: better functionality in query ?
> 
> 
> I'm in process of creating a online whitepages directory for
> a small town phone company and I am having a little difficulty
> in refining my selection. My search form has two fields; last
> and first name. I would like to be able to have more of a wild
> card approach and some refinement when a user enters both a
> first and last name. I am unsure how to go about this, should
> I restructure my query, or make changes to my PHP. here is the
> query I am currently using. and the site is located at
> http://whitepages.maadtelco.com/ any assistance/direction is certainly
> appreciated.
> 
> <snip>
> $query = "select * from whitepages WHERE last_name LIKE 
> '$last_name' ORDER
> BY last_name" or die("Nothing to see here");
> </snip>
> 
> Jerry Lake            - [EMAIL PROTECTED]
> Web Designer
> Europa Communications - http://www.europa.com
> Pacifier Online           - http://www.pacifier.com
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to