How to verify 2 kinds of account?
<p>Is it possible for the program to verify if the account credentials inputted by the user belongs to a certaing kind of account? if yes, how?
For example:</p>

<p>Database</p>

<pre><code>username                      password
jake (admin)                   qwerty
anna (student)                 asdf
</code></pre>

<p>If the user inputted jake and qwerty as logon credentials then he would be able to access admin menus and when he used
student account anna and asdf then he'll be able to access student menus.</p>

<p>Logon Button:</p>

<pre><code>private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    //str = JOptionPane.showInputDialog(this, "Enter id number: ");
    user = jTextField1.getText();
    pass = jPasswordField1.getPassword();
    login();
}
</code></pre>

<p>Function</p>

<pre><code>private void login() {

    try {
        if ((user != null)&amp;&amp;(pass != null)) {
            sql = "Select * from users_table Where username='" + user + "' and password='" + pass + "'";
            ResultSet rs = stmt.executeQuery(sql);
            if( rs.next()) {
                JOptionPane.showMessageDialog(null, "A basic JOptionPane message dialog");
            } else {
                //in this case enter when  result size is zero  it means user is invalid
            }
        }
    } catch (SQLException err) {
        JOptionPane.showMessageDialog(this, err.getMessage());
    }
}
</code></pre>
