On 18-Mar-01 Tom Beidler wrote:
> I'm trying to populate a pulldown menu with distinct values from a found set
> using the following query.
> 
> SELECT DISTINCT name FROM request
>     WHERE id <= '5' OR demo_id = '$demo_id'
>     ORDER BY name
> 
> Apparently I am doing something wrong. If I have a record with the same name
> that meets the WHERE parameters and one that doesn't, the name won't appear
> in my pulldown menu.
> 

Try your query from mysql, compare the results to your html source (likely
you've muffed a <OPTION> tag).

mysql> select * from request;
+--------+------+---------+
| name   | id   | demo_id |
+--------+------+---------+
| Stuart |    2 | abc     |
| Bob    |    5 | edf     |
| Stuart |    5 | xyz     |
| Stan   |    1 | bcd     |
| Mark   |    1 | lmn     |
+--------+------+---------+
5 rows in set (1.06 sec)

mysql> select distinct(name) from request where id <5 or demo_id='lmn';
+--------+
| name   |
+--------+
| Stuart |
| Stan   |
| Mark   |
+--------+
3 rows in set (0.48 sec)


Regards,
-- 
Don Read                                         [EMAIL PROTECTED]
-- If you are going to sin, sin against God, not the bureaucracy. 
                  God will forgive you but the bureaucrats won't. 

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

Reply via email to