PerenSap Posted February 13, 2012 Share Posted February 13, 2012 Hello, first im not english so please dont hate when ive wrote someting wrong.. well ive a little question. i made a drop down box and in this box i see (select * from naw) all de rows i have in 'naw'. i want to see all places i have my row called 'plaats' (db = ws2 -> naw -> row = plaats.) <?php mysql_connect('localhost', 'root', ''); mysql_select_db('ws2'); $result = mysql_query('SELECT * FROM naw'); while($row = mysql_fetch_array($result)) ?> <select name="hallo"> <?php $i = 0; while ($i < mysql_num_fields($result)){ $fieldname = mysql_field_name($result, $i); echo '<option value="'.$fieldname.'">'.$fieldname.'</option>'; $i++; } ?> </select> Quote Link to comment https://forums.phpfreaks.com/topic/257074-probably-its-very-easy-just-a-little-question/ Share on other sites More sharing options...
smerny Posted February 13, 2012 Share Posted February 13, 2012 i'm not sure i'm clear on what you want, but think you're looking for this while ($row = mysql_fetch_array($result)){ $fieldname = $row['plaats']; echo '<option value="'.$fieldname.'">'.$fieldname.'</option>'; } Quote Link to comment https://forums.phpfreaks.com/topic/257074-probably-its-very-easy-just-a-little-question/#findComment-1317824 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.