Hi Jess

Have you tried SELECT DISTINCT

not sure if 'select distinct *' will work but if doesn't 'select distinct userlastname,userfirstname' will

hope this helps

Steve Davies


Hunter, Jess wrote:


Using PHP as the front end I am creating a form with a dropdown box that
displays information from one table to be inserted into another table.
That's PHP and I have gotten that part down with no issue.

However, in the table a person could be listed multiple times and I only
want a user to be listed a single time. for instance in the table I may have

Jones, Jim
Jones, Mary
Jones, Mary
Jones, Mary
Jones, Nancy
Jones, Paul

when I do my SELECT I only want Mary Jones to show up a single time.

Here is the code I am currently using within the Dropdown box:

<SNIPPET>
$Link = mysql_connect($Host, $User, $Password);
$Query="SELECT * from $TableName ORDER BY userlastname";
$Result= mysql_db_query ($DBName, $Query, $Link);

while ($Row = mysql_fetch_array ($Result)){



print ("<option value='$Row[userlastname],
$Row[userfirstname]'>$Row[userlastname], $Row[userfirstname]</option>");
}
mysql_close ($Link);
?>
</SNIPPET>

As you can see I am pulling two fields from one table, then combining them
to make a single field in another table. I am doing this to provide
continuity when I create queries in the future.

Any help with this would be greatly appreciated

Jess


--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.550 / Virus Database: 342 - Release Date: 12/9/03







-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to