Home DIstinct values and id's on selection in select box
Reply: 0

DIstinct values and id's on selection in select box

user978
1#
user978 Published in May 23, 2018, 7:19 am

It may sound a little easy but I am not getting any clues on this. I want to populate a select box with distinct values in a column and I need id's of them too. I am making an ajax request on selecting a value from the drop-down which takes id of selected value and processes it further. Currently, I have my query as shown below but using this the select box options get empty.

$sql = mysql_query("SELECT rpp_id,DISTINCT rpp_regn_bulkbatch_no  FROM tbl_regn_prescribed_parameters where rpp_regn_bulkbatch_no  != 0 GROUP BY rpp_regn_bulkbatch_no" ) ;
                  while ($row = mysql_fetch_assoc($sql)){  
                     $rpp_id    = $row['rpp_id'];
                     $rpp_bulkbatch_no    = $row['rpp_regn_bulkbatch_no'] ;
             echo "<option value=" . $rpp_id . ">" . $rpp_bulkbatch_no . "</option>"; 

Can i know what should be the proper query for this? Any help will be highly appreciated.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.329982 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO