[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Select statement not outputing

This is some really basic script, but for some reason my select box is not outputting my query results.  I must be going crazy because normally I can figure these out quite quickly, but I'm stumped.  I know it is something very simple (as always), but I can't pin point it.

<div class="">
                              <?php
                                    $getCats = sprintf("SELECT category
                                          FROM main_categories
                                          ORDER BY category");
                                    $catsGot = mysql_query($getCats) or die("Cats did not get because: " . mysql_error);
                              ?>
                              <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
                                    <select name="category">
                                          <?php
                                                while($m = mysql_fetch_array($catsGot)) {
                                                      echo "<option value='<?= {$m['category']} ?>'><?= {$m['category']} ?></option>";
                                                }
                                          ?>
                                    </select>
                              </form>
                        </div>
0
pingeyeg
Asked:
pingeyeg
1 Solution
 
gr8gonzoConsultantCommented:
It's probably because of this line:

 echo "<option value='<?= {$m['accountID']} ?>'><?= {$m['accountID']} ?></option>";

Try;

 echo "<option value='" . $m['accountID'] . "'>" . $m['accountID'] . "</option>";
0
 
pingeyegAuthor Commented:
Like I said.  That was simple.  I do that all the time.  Argh!!  Thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now