Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. String fname = request.getParameter("username");
  2. String mail = request.getParameter("email");
  3. String country = request.getParameter("country");
  4. String pword = request.getParameter("password");
  5.  
  6. Class.forName("com.mysql.jdbc.Driver");
  7. Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/foodforthought", "root",
  8. "ajay143enexl");
  9. Statement statement = connection.createStatement();
  10. try {
  11. int i = statement.executeUpdate("insert into users (username,email,country,password) values ("+fname+"','"+mail+"','"+country+"','"+pword+")");
  12. out.println("Successfully registered");
  13. } catch (Exception e) {
  14. out.println(e);
  15. e.printStackTrace();
  16. }
  17.  
  18. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'India',')' at line 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement