How can i fix this?
I tried driver managers getconnection but it would work, i have correct imports.
These are the only three errors i get:
Code:
src\server\model\players\packets\Commands.java:730: cannot find symbol
symbol : variable database
location: class server.model.players.packets.Commands
PreparedStatement ps = database.getConne
ction().prepareStatement("SELECT * FROM votes WHERE username = ? AND used = '1'
LIMIT 1");
^
src\server\model\players\packets\Commands.java:737: cannot find symbol
symbol : variable database
location: class server.model.players.packets.Commands
ps = database.getConnection().pr
epareStatement("SELECT * FROM votes WHERE authcode = ? AND used = '0' LIMIT 1");
^
src\server\model\players\packets\Commands.java:742: cannot find symbol
symbol : variable database
location: class server.model.players.packets.Commands
ps = database.getConnect
ion().prepareStatement("UPDATE votes SET used = '1' WHERE authcode = ?");
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
Press any key to continue . . .
The command :
Code:
if (playerCommand.startsWith("auth") && playerCommand.length() > 5) {
if (!Config.MYSQL_ACTIVE) {
c.sendMessage("Sorry this is currently disabled.");
return;
} else {
try {
PreparedStatement ps = Database.getConnection().prepareStatement("SELECT * FROM votes WHERE username = ? AND used = '1' LIMIT 1");
ps.setString(1, c.playerName);
ResultSet results = ps.executeQuery();
if(results.next()) {
c.sendMessage("You have already voted once today.");
} else {
ps.close();
ps = Database.getConnection().prepareStatement("SELECT * FROM votes WHERE authcode = ? AND used = '0' LIMIT 1");
ps.setString(1, playerCommand.substring(5));
results = ps.executeQuery();
if(results.next()) {
ps.close();
ps = Database.getConnection().prepareStatement("UPDATE votes SET used = '1' WHERE authcode = ?");
ps.setString(1, playerCommand.substring(5));
ps.executeUpdate();
//givem the reward
c.sendMessage("Thank you for voting.");
} else {
c.sendMessage("The auth code is not valid!");
}
}
ps.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return;
}
Thanks in advance :]!