RE: query problem

2005-08-08 Thread ganesan malairaja

i have checked all.. there is no other username

i have put all the codes involved in the coding..

please point out the mistake ..


html
head
title
Staffing
/title
/head
h1Add Staff/h1
body

%@ page language=java import=java.sql.* %
%!
String con_url =  jdbc:mysql:///AAAServer?user=tjcpassword=password;
Connection c;
Statement stmt1;
String username,password,AdminName;
%

%




   try
   {
   Class.forName(com.mysql.jdbc.Driver).newInstance();
   }

   catch (Exception E)
   {

   System.err.println(CONCEPT: Unable to Load Driver );
   E.printStackTrace();
   }

%



table border=0 cellpadding=10
tr


%

   //   System.out.println(Connecting...);
   c = DriverManager.getConnection(con_url);
   //  System.out.println(Connection ok:  + c);



stmt1 = c.createStatement();
%
thUserName/th
td
form
input type=text name=username1 size=8

%
username = request.getParameter(username1);
%

/form
/td
/tr
tr
thName/th
td
form
input type=text name=AdminName size=12

/form
/td
/tr
tr
thPassword/th
td
form
input type=password name=password size=8
input type=submit name=Add value=AddStaff
/form
/td
/tr
/table
/body
/html
%

String submit1 = request.getParameter(Add);

if(submit1 == null)
{


}


else
{


password = request.getParameter(password);
AdminName = request.getParameter(AdminName);
		String query7 = Insert into 
Admin(UserName,PassWord,Admin_type,Admin_Name) 
values('+username+','+password+', 'Staff','+AdminName+');


stmt1.executeUpdate(query7);
stmt1.close();

}
%



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: query problem

2005-08-07 Thread Marot Laurent
Hello,

Are you sure you don't have another filed name=username somewhere else in 
your jsp code ?

Lau/
 

-Message d'origine-
De : ganesan malairaja [mailto:[EMAIL PROTECTED] 
Envoyé : lundi 8 août 2005 06:28
À : tomcat-user@jakarta.apache.org
Objet : query problem


i am extracting info from html forms .. but one of the field allways return the 
value null only

html code

form
input type=text name=username size=8 /form

jsp code

String username = request.getParameter(username);

SQL codes;

String query7 = Insert into Admin(UserName,PassWord,Admin_type,Admin_Name)
values('+username+','+password+', 'Staff','+AdminName+');

it returns the username as null

i cant figure out what is  the problem
..

any links or example how to do it properly will help

thanks

stmt1.executeUpdate(query7);
stmt1.close();



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]