Hi,
I have any dropdown box(combobox) for retrieve data ! this dropdown box list user for each user id. now when i filter result my code not work! my database is :
member :
id | name | age | datanum
products :
id | uid | name | cat | datanum |etc..

i want to show name of member column when datanum = $localid and uid was not in products.

<?php
$localid = $_GET["id"]; ?>
<form>
<SELECT name="localid" onchange="reload(this.form)">
                        <OPTION value=0
                          <? if($localid==0) {echo " selected ";}?>>select
                        <?
                        $country2=mysql_query("select uid from products where datanum='$localid'");
                          $rst6= mysql_fetch_assoc($country2);
                          $namename=$rst6["uid"];
                          $country1=mysql_query("select * from members where datanum='$localid' and
                           id !='$namename'");
                          while($rst= mysql_fetch_assoc($country1))
                          {
                          ?>
                        <OPTION value=<? echo $rst["id"];?> <? if($rst["id"]==$userid) {echo " selected ";}?>><? echo $rst["name"];?></OPTION>
                        <?
                               } // wend
                               ?>
                      </SELECT></form>

Thanks For Any Help

Recommended Answers

All 2 Replies

join the queries like:

$country2=mysql_query("select products.* from members,products where products.datanum='$localid' and members.id!=products.uid");

if not, explain your problem clearly.

join the queries like:

$country2=mysql_query("select products.* from members,products where products.datanum='$localid' and members.id!=products.uid");

if not, explain your problem clearly.

your code not list any data in dropdown box.
three user add any list of member in my work office. For each user insert datanum to database example :
id | name | datanum |
1 | john | 2 |
2 | test | 1 |
3 | char | 3 |
4 | bovi | 1 |
5 | nume | 1 |

Now For each member add products Example : ( Uid = member id )

id | uid | productname | datanum |
1 | 2 | php12345678 | 2 |
2 | 5 | java1234678 | 1 |
3 | 4 | webdesign | 1 |
4 | 3 | logodesign | 3 |
5 | 1 | .net | 3 |
6 | 2 | testtes | 3 |

my url for each user is : mydomain.com/index.php?id=1/2/3 etc..
Now i want to list member in combobox( dropdown box ) when :

id = datanum ($localid=$_GET["id"];)
and uid != products . (filter member was in products)

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.