Modal Does Not Return Database

Asked

Viewed 38 times

0

I have a table in the database called pathologies. Inside this table is a column called disease. I created a modal that should return a dropdownlist with all the disease options filled in the table in this column for user selection. However, the modal is returning an extamanet dropdownlist with the same number of rows in the table but empty. Below is the code. I will be eternally grateful to those who help. I have been locked in this problem for 4 days:

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> 

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>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.