I keep getting an error where the symbol cannot be resolved and the arrow pointing to where i have written statement.ExcecuteUpdate
Am not able to insert any data into my database, can anyone see where i may have gone wrong. thanx
heres the code:
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%
String connectionURL = "jdbc:mysql://localhost:3306/learningtest";
Connection connection = null;
Statement statement = null;
int UQ=0;
%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Submit Question</title>
</head>
<body>
<h1>Submit Question</h1>
<%
String questionin = request.getParameter("questionin");
String answerin = request.getParameter("answerin");
String subjectin = request.getParameter("subjectin");%>
<td align="right">Question:</td>
<td><%=questionin %></td>
<br>
<td align="right">Answer:</td>
<td><%=answerin %></td>
<br>
<td align="right">Subject:</td>
<td><%=subjectin %></td>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "", "");
statement = connection.createStatement();
UQ=statement.executeUpdate("INSERT INTO questions" +
"(qid, question, answer, subject)" + "VALUES (" ," + questionin + "," + answerin + "," + subjectin)" );
out.println("Question Added Success");
statement.close();
%>
</body>
</html>
p.s. the excecutequery works fine i can read from the database so there isnt anyprobs with the connection string