title: Select option from dropdown menu with PHP and mySql
body: <p>I tried to create a simple select dropdown menu from MySQL database. However, it does not work on my code.</p>
  
  <p>Here is my code: </p>
  
  <pre><code>            &lt;?php
                mysql_select_db($database_conn, $conn);
                $query_RsCourse = "SELECT * FROM tbl_course ORDER BY courseid DESC";
                $RsCourse = mysql_query($query_RsCourse, $conn) or die(mysql_error());
                $totalRows_RsCourse = mysql_num_rows($RsCourse);
                $count=0;
                while ( $row = mysql_fetch_array($RsCourse, MYSQL_ASSOC)) {
                $courseid=$row["courseid"];
           $count++;  
                }
               ?&gt;
  
              &lt;tr&gt;
              &lt;td bgcolor="#CCCCCC"&gt;&amp;nbsp;Course Name&lt;/td&gt;
              &lt;td bgcolor="#dfdfdf"&gt;&amp;nbsp;&lt;select name="courseid"&gt;
              &lt;option value="" SELECTED&gt;Selected Course&lt;/option&gt;      
              &lt;option value="&lt;?php echo $courseid; ?&gt;"&gt;&lt;?php echo $row_RsCourse['$courseid']; ?&gt;&lt;/option&gt;
              &lt;/select&gt;
              &lt;/td&gt;
              &lt;/tr&gt;
  </code></pre>
  
  <p>Any advice will be appreciated!</p>