Return-Path: Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 11305 invoked from network); 21 Dec 2000 13:53:33 -0000 Received: from node1-clt.ratedg.com (216.189.14.48) by locus.apache.org with SMTP; 21 Dec 2000 13:53:33 -0000 Received: from jelia (711hq-nat-1.ratedg.com [209.198.61.193] (may be forged)) by node1-clt.ratedg.com (8.11.1/8.11.1) with SMTP id eBLDuAP25920 for ; Thu, 21 Dec 2000 08:56:10 -0500 Message-ID: <004301c06b55$0fe40d90$4306000a@jelia> From: "John Elia" To: References: <000f01c06b08$de7cb8c0$f90a0ac8@yaya> Subject: my jsp updates with null values. Date: Thu, 21 Dec 2000 08:50:59 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N This code is inserting NULL values into a mysql database. It is taking the values from an HTML form, and should just insert the values. Please Help. <%@page import="java.sql.*,javax.servlet.http.HttpServletRequest" %> <%! //Declare your variables; String DRIVER = "org.gjt.mm.mysql.Driver"; String CONNECT = "jdbc:mysql://127.0.0.1/userinfo"; String QUERY = "insert into info values('"+idnum+"','"+fname+"','"+lname+"','"+addr1+"','"+addr2+"','"+city+" ','"+state+"','"+zip+"','"+phone1+"')"; %> <% //some debug code to see what the values of these fields are... (not working) out.println(idnum); out.println(fname); out.println(lname); out.println(addr1); out.println(addr2); out.println(city); out.println(state); out.println(phone1); %> <% //get information from another page, and, if there is no information, set the values to NULL String idnum = request.getParameter("idnum"); String fname = request.getParameter("fname"); String lname = request.getParameter("lname"); String addr1 = request.getParameter("addr1"); String addr2 = request.getParameter("addr2"); String city = request.getParameter("city"); String state = request.getParameter("state"); String zip = request.getParameter("zip"); String phone1 = request.getParameter("phone1"); %> <% //Let's figure it out shall we? Class.forName(DRIVER); Connection con = DriverManager.getConnection(CONNECT); Statement stm = con.createStatement(); ResultSet rs = stm.executeQuery(QUERY); %>


WebDesk Development USERINFO Database Accessed, INFO Table Results returned.


Back to the Form