Solved

Select statement not outputing

Posted on 2009-04-07
2
198 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
2 Comments
 
LVL 34

Accepted Solution

by:
gr8gonzo earned 250 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now