简体   繁体   中英

Populating HTML 'select' drop down using sql array - Code not working

I am using the below code to take each individual value out of an array returned by an sql query. When the page runs, the dropdown box is populated by the correct number of spaces. 4 at the moment. However, there is no information in those spaces. The drop down box is simply populated by 4 blank spaces. Any ideas??

Date Selection:
        <select name="dateselection">

        <?php

            $i = 0;
            while ($i < $num)
            {
                $thedate = mysql_result(results, $i, 'date');

                ?>

                <option> <?php echo $thedate; ?> </option>>



                <?php


                $i++;
            }

        ?>

        </select>

You've missed a dollar sign:

$thedate = mysql_result(results, $i, 'date');
                        ^-- HERE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM