Hello,

I am trying to populate a listbox.here are my codes which works fine.

 <?php
                            echo "<select name=name value=''>Exten Name</option>";
                            while($nt1=mysql_fetch_array($result_users)){//Array or records stored in $nt
                                echo "<option value=$nt1[name]>$nt1[name]</option>";
                                /* Option values are added by looping through the array */
                            }
                            echo "</select>";// Closing of list box
                            ?>

These data are taken from table Users and save to table queue.

i want to add a validation where it check if a user already exists in table queues, if it does exist, it should not available in the listbox.

Can you advise how to start and where to put the arguments.

Recommended Answers

All 4 Replies

Why dont you select DISTINCT from your query or Group BY ?

Just use distinct names, just like in the code below;

SELECT DISTINCT name FROM ...

This will return only one instance of the records from the database.

can i get one example with you guys

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.