Hi there,
Assuming that you are using code similar to charlie’s post on page 1 of this thread, add some System.out.println statements to see what is happening.
Statement stmt = null;
ResultSet rs = null;
try
{
stmt = conn.createStatement();
String sql = "SELECT count(*) as userCount FROM users where username = '"+userName+"' and password = '"+password+"'";
System.out.println("sql: "+sql);
rs = stmt.executeQuery(sql);
if (rs.next() == true)
{
System.out.println("rs.getInt("userCount"): "+rs.getInt("userCount") );
if (rs.getInt("userCount") > 0)
{
System.out.println("client.acceptConnection()");
client.acceptConnection();
}
}
else
{
System.out.println("Error - userCount = 0. Rejecting connection");
}
}
I have added the sql statement as a seperate string so it can be checked for syntax.
You can also copy and paste the sql into phpmyadmin or another sql client and check it is working as expected.
Try this a see what happens.
Roger.