?
Solved

Select statement not outputing

Posted on 2009-04-07
2
Medium Priority
?
208 Views
Last Modified: 2012-05-06
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
Comment
Question by:pingeyeg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
gr8gonzo earned 1000 total points
ID: 24093082
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
 
LVL 1

Author Comment

by:pingeyeg
ID: 24093103
Like I said.  That was simple.  I do that all the time.  Argh!!  Thanks
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question