T'would help had you provided us with your code. Regardless, create your
SELECT box such that the values are comprised of first name and last name
separated by +. The construction would appear liek:
<SELECT name="thename">
<OPTION value="John+Smith">John Smith</OPTION>
<OPTION value="John+Van Buren">John Van Buren</OPTION>
<OPTION value="Sam+Jones">Sam Jones</OPTION>
<OPTION value="Chuck+Barnett">Chuck Barnett</OPTION>
<OPTION value="Zsa Zsa+Gabor">Zsa Zsa Gabor</OPTION>
<OPTION value="Frank+Zappa">Frank Zappa</OPTION>
</SELECT>
process.php --------------------------
$fname = ereg_replace("^(.*)+", "\\1", $thename);
$lname = ereg_replace("+(.*)$", "\\1", $thename);
$query = "SELECT * FROM mytable WHERE first_name=\"$fname\" &&
last_name=\"$lname\"";
$result = mysql_query($query);
-----Original Message-----
From: Chuck Barnett [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 04, 2002 11:21 AM
To: Rick Emery; [EMAIL PROTECTED]
Subject: Re: Query help
This will not work for my example. I have a select box that was populated
from the db with firstname lastname. The option tag has the value of
firstname+lastname then. Here lies the problem, when I build the query, I
have no way of distinguishing firstname and lastname.
Chuck
----- Original Message -----
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "'Chuck Barnett'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, April 04, 2002 11:06 AM
Subject: RE: Query help
> SELECT * FROM mytable WHERE first_name=$first && last_name=$last
>
> -----Original Message-----
> From: Chuck Barnett [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 04, 2002 10:28 AM
> To: [EMAIL PROTECTED]
> Subject: Query help
>
>
> Hi. I have two fields, firstname, lastname. I populate a select box with
> the firstname lastname. Now when a user selects a name and hits submit,
the
> program will(should) select * from table where the selected name equal
> firstname+lastname. I guess you have to some how put the first and last
> name together and compare the selected name to it....I dunno
>
> Thanks for help with this query.
>
> Chuck
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php