i want to get the Number of Entries in a table in My java Project.
This is my code:
int count = 0;
Statement st = Mysql.con.createStatement();
ResultSet rs= st.executeQuery("select count(*) from keys where spieler =" +p.getName());
while (rs.next()){
count = rs.getInt(1);
}
I am getting following SQLEXCEPTION:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server version for the
right syntax to use near 'keys where spieler =Pit910' at line 1
What is worng?
Thanks!
spielera text field in the DB?