Modal Does Not Return Database

0

I have a table in the database called pathologies. Within this table there is a column called disease. I created a modal that should return a dropdownlist with all the disease options populated in the table in this column for user selection. However the modal is returning an extamanet dropdownlist with the same number of empty table rows. Follow the code below. I will be eternally grateful to whom to help. I'm stuck for 4 days on this issue:

conecta_mysql (); $ result = mysql_query ($ query); ? >
<select name="doencaap1" required>
                    <option>Selecione...</option>
                    <?php while($prod = mysql_fetch_array($result)) { ?>
                            <option value="<?php echo $prod['doenca'] ?>"><option style = "color:red"></option>  
                     <?php } ?>
            </select> 
    
asked by anonymous 23.11.2016 / 16:15

1 answer

0
               Ja tentou com foreach ?

                 <select name="category_id" class="form-control">
                        <option value="">CATEGORIA</option>
                        <?php foreach ($medics as $p): ?>
                            <option value="<?php echo $p->id; ?>" <?php
                            if (isset($_GET["category_id"]) && $_GET["category_id"] != "") {
                                echo "selected";
                            }
                            ?>><?php echo $p->name; ?></option>
                                <?php endforeach; ?>
                    </select>
    
23.11.2016 / 16:21