Drop Down boxes from MYSQL

I'm trying to get drop down box with the date of the past 10 days. I'm pulling the information from the food_eaten table and the name of the field is date_eaten. The code below is what i have at the moment and need some pointers in the right direction because the code is not working. Also when i have the code, how do i keep track of what date the user has chosen(1 thru 10)?

<%
     Connection dbconn;
     try
     {
          Class.forName("org.gjt.mm.mysql.Driver").newInstance();
          try
          {              
               dbconn = DriverManager.getConnection("jdbc:mysql://localhost/nutrition","saundersk","kevin");
               out.println("Connected");
                   
         
          <select name=date>
          <%
         
         
          Statement stmt = dbconn.createStatement();
          ResultSet rs = stmt.executeQuery("select date_eaten from food_eaten");
         
          while (rs.next())
          {
               %>
               <option value="<%= rs.getString("date_eaten") %>"><%= rs.getString("date_eaten") %>
               <%
          }
          rs.close();
          stmt.close();
          con.close();
          %>
         
          </select>
         
          }          
          catch (SQLException s)
          {
               out.println("SQL Error<br>");
          }
     }
     catch (ClassNotFoundException err)
     {
          out.println("Class loading error");
        }
%>
sredmusarmAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bobbit31Commented:
first, i'd stay away from using names like date b/c it's a reserved word:

<select name=date>

also,
con.close();

should be

dbconn.close();

what exactly isn't working?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sredmusarmAuthor Commented:
Thanks for the start...The error that apache is giving me is illegal start of expression and then underneath that it gives me the picture of a drop down box?
0
bobbit31Commented:
what's the extension of your page? it should be *.jsp

i don't see anything wrong with the above code.

0
sredmusarmAuthor Commented:
yeah the extension is .jsp
0
sredmusarmAuthor Commented:
yeah the extension is .jsp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.