title: How to insert date into a mysql database from a jsp page?
body: <p>I am trying to insert data into MySQL database where one of the column gets the current date. </p>
  
  <p>The code is </p>
  
  <pre><code>unit=request.getParameter("unit");
  name=request.getParameter("name");
  article=request.getParameter("article");
  String user=request.getParameter("username");
  Class.forName("com.mysql.jdbc.Driver");
  Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/newsletter?", "root", "pooja");
  Statement st = conn.createStatement();
  
  String query="insert into browse values('"+0+"','"+name+"', '"+NOW()+"', '"+article+"', '"+unit+"', '"+user+"' );";
  ResultSet rs = st.executeQuery(query);
  </code></pre>
  
  <p>The code throws an error at NOW() saying the method is undefined.
  Is there any correction I can make in this code itself or is there any other way I can enter the current date into the database?</p>
  
  <p>Thanks in advance.</p>