title: Update Function not working
body: <p>I'm trying to to do an update and it's not working and throwing this error:</p>
  
  <blockquote>
    <p>sql=com.mysql.jdbc.JDBC42PreparedStatement@2b4a207c: update backup.add_event set title='hhh',eventDesc='jj',StartTime='02:00:AM' EndTime='02:00:AM',Budget=234.0,StartDate='2017-09-01',EndDate='2017-09-01',Environment=null
    Error=Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EndTime='02:00:AM',Budget=234.0,StartDate='2017-09-01',EndDate='2017-09-01',Envi' at line 1</p>
  </blockquote>
  
  <p>I tried checking like a hundred times and seriously can't find the error</p>
  
  <pre><code>DBAO.java:
  ....
  
  public boolean updateEvent(AddEvents myEvent)throws Exception{
      try
      {
          String updateStatement= "update backup.add_event set title=?,eventDesc=?,StartTime=? EndTime=?,Budget=?";
          updateStatement = updateStatement+",StartDate=?,EndDate=?,Environment=?";
          PreparedStatement prepStmt = con.prepareStatement(updateStatement);
          prepStmt.setString(1,myEvent.getTitle());
          prepStmt.setString(2,myEvent.getEventDesc());
          prepStmt.setString(3,myEvent.getStartTime());
          prepStmt.setString(4,myEvent.getEndTime());
          prepStmt.setDouble(5,myEvent.getBudget());
          prepStmt.setDate(6,(Date) myEvent.getStartDate());
          prepStmt.setDate(7,(Date) myEvent.getEndDate());
          prepStmt.setString(8,myEvent.getEnvironment());
  
  
          System.out.println("sql=" +prepStmt.toString());
          int status = prepStmt.executeUpdate();
      if(status!=0)
      {
          System.out.println("Record updated");
          return true;
      }
      else
      {
          return false;
      }
  
  }catch(Exception ex)
  {
      throw new Exception("Error:" +ex.getMessage());
  }
  
  }
  }   
   UpdateServlet:
  package servlet;
  
  import java.io.IOException;
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpSession;
  
  import database.DBAO;
  import model.AddEvents;
  
  /**
   * Servlet implementation class UpdateServlet
   */
  @WebServlet("/UpdateServlet")
  public class UpdateServlet extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      /**
       * @see HttpServlet#HttpServlet()
       */
      public UpdateServlet() {
          super();
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
          //response.getWriter().append("Served at: ").append(request.getContextPath());
      }
  
      /**
       * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
          //doGet(request, response);
          AddEvents myEvent = new AddEvents();
  
          myEvent.setTitle(request.getParameter("Title"));
          myEvent.setEventDesc(request.getParameter("EventDesc"));
          myEvent.setStartDate(java.sql.Date.valueOf(request.getParameter("StartDate")));
          myEvent.setEndDate(java.sql.Date.valueOf(request.getParameter("EndDate")));
          myEvent.setStartTime(request.getParameter("StartTime"));
          myEvent.setEndTime(request.getParameter("EndTime"));
          //myEvent.setBudget(request.getParameter("Budget"));
          myEvent.setBudget(Double.valueOf(request.getParameter("Budget")));
          myEvent.setEnvironment(request.getParameter(request.getParameter("Environment")));
          try
          {
              DBAO myDatabase = new DBAO();
              boolean status= myDatabase.updateEvent(myEvent);
              if(status)
              {
                  HttpSession mysess = request.getSession(true);
                  mysess.setAttribute("Event_Info", myEvent);
                  request.getRequestDispatcher("Retrieve.jsp").forward(request, response);
  
              }
              else{
                  request.getRequestDispatcher("Update.jsp").forward(request,response);
              }
          }
          catch(Exception ex)
          {
              System.out.println("Error="+ex.getMessage());
          }
      }
  
  }
  </code></pre>