PHP:
this.rs = this.stmt.executeQuery("SELECT * FROM Voters;");
while (this.rs.next()) {
if (ID.equalsIgnoreCase(this.rs.getString("ID"))) {
JOptionPane.showMessageDialog(null, "User already registered", "ERROR", 0);
run = false;
}
}
if you had a million Voters, that could get slow
Change this to a "SELECT ID FROM Voters where ID=?"
PHP:
this.rs2 = this.stmt.executeQuery("SELECT * FROM Accounts;");
this.rs2.first();
this.rs2.moveToInsertRow();
this.rs2.updateString("ID", ID);
this.rs2.updateString("Password", Password);
this.rs2.insertRow();
this.rs = this.stmt.executeQuery("SELECT * FROM Voters;");
this.rs.moveToInsertRow();
this.rs.updateString("ID", ID);
this.rs.updateString("Name", Name);
this.rs.updateString("Surname", Surname);
this.rs.updateString("Race", Race);
this.rs.updateString("Address", Address);
this.rs.insertRow();
this.rs.close();
same here, rather use "INSERT INTO Accounts (ID, Password) VALUES (?, ?)"