yossi avisror

Greenhorn
+ Follow
since May 07, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by yossi avisror

i would like to get the right sql method to add new column into exist table
(i am using mysql server).
thankes for your help daniel
well i changed the the PrintWriter string like your's and it workes the answer i get is 'good' but what i want to get with the PrintWriter is a new html page and i can't get it and i dont know what is my mistake.
(i also changed the if command)
[This message has been edited by yossi avisror (edited May 26, 2001).]
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ExamSet extends HttpServlet
{
private String teacherid;
private String examsubject;
private static Connection connection;
private Statement checkIfLoged;

public void init()
{
try
{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
}
catch(Exception e)
{
System.out.println("Registering the Driver was failed");
}
try
{
connection = DriverManager.getConnection
("jdbc:mysql://localhost:3306/ExamDB");
}
catch(Exception exception)
{
System.out.println("Connection with the DataBase failed");
exception.printStackTrace();
System.exit(1);
}
}
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException,IOException
{
Exams exam =new Exams(connection);
res.setContentType("text/html");
teacherid=req.getParameter("teacherid");
examsubject=req.getParameter("subject");
*********************************************
try
{
checkIfLoged=connection.createStatement();
ResultSet rs=checkIfLoged.executeQuery("SELECT id FROM students WHERE id="+teacherid);
if (rs.equals(teacherid))
{ PrintWriter outt=res.getWriter();
outt.println(" wrong ");
outt.close();
}
else
{
PrintWriter outtt=res.getWriter();
outtt.println(" wrong ");
outtt.close();
}
*********************************************
try
{
exam.addNewExam(teacherid,examsubject);
}
catch(SQLException sql){}
}
catch(Exception e){}
}
}

[This message has been edited by yossi avisror (edited May 26, 2001).]
[This message has been edited by yossi avisror (edited May 26, 2001).]

i would like to get the sql method
which is run over a col and check for a word
if it in my table.
[This message has been edited by yossi avisror (edited May 18, 2001).]