How can I convert the query from SQL to LINQ?

Sql drop down menu question?

  • Hi i was just wondering if anyone knew how to generate a drop down menu with sql. The section of code i have that has to be changed is <div> <span class="bold">Choose a lecturer:</span><br> <?php // note how the keyword "distinct" in the following query prevents duplicate values from being returned $dbQuery="select distinct lecturer from p3_modules"; $dbResult=mysql_query($dbQuery,$db); // convert this loop to generate a drop down list (3a) // the value of each <option> element should be the lecturer's name // enclose the drop down list in a form with action=showModules.php while ($dbRow=mysql_fetch_array($dbResult)) { $thisLecturer=$dbRow["lecturer"]; echo "$thisLecturer<br>"; } // add a submit button for the form ?> </div>

  • Answer:

    echo " <option>$thisLecturer</option>";

Laura at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

echo " <option>$thisLecturer</option>";

Mark O

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.