Error - MySQL - DBLib

JackboyPlay

Пользователь
Hello, If I want to check if a player is in the database "registered" I'll get an error:
Code:
13:51:30 [CRITICAL] "Could not pass event 'cn.nukkit.event.player.PlayerJoinEvent' to 'JCLoginSystem v1.0': null on me.JackboyPlay.Listener.PlayerJoin
13:51:30 [ALERT] cn.nukkit.utils.EventException
	   at cn.nukkit.plugin.MethodEventExecutor.execute(MethodEventExecutor.java:34)
	   at cn.nukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:56)
	   at cn.nukkit.plugin.PluginManager.callEvent(PluginManager.java:557)
	   at cn.nukkit.Player.doFirstSpawn(Player.java:770)
	   at cn.nukkit.Player.sendNextChunk(Player.java:725)
	   at cn.nukkit.Player.checkNetwork(Player.java:1565)
	   at cn.nukkit.Server.tick(Server.java:996)
	   at cn.nukkit.Server.tickProcessor(Server.java:789)
	   at cn.nukkit.Server.start(Server.java:768)
	   at cn.nukkit.Server.<init>(Server.java:459)
	   at cn.nukkit.Nukkit.main(Nukkit.java:65)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'jackboyplay' in 'where clause'
	   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	   at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	   at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
	   at com.mysql.jdbc.Util.getInstance(Util.java:387)
	   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
	   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
	   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
	   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
	   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
	   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
	   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503)
	   at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369)
	   at me.JackboyPlay.JCLogin.JCLogin.loginPlayer(JCLogin.java:125)
	   at me.JackboyPlay.Listener.PlayerJoin.onJoin(PlayerJoin.java:16)
	   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	   at java.lang.reflect.Method.invoke(Method.java:498)
	   at cn.nukkit.plugin.MethodEventExecutor.execute(MethodEventExecutor.java:29)
	   ... 10 more
My code:
PHP:
123 | @SuppressWarnings("deprecation")
124 |   public static boolean loginPlayer(Player player) throws NumberFormatException, SQLException{
125 |	   ResultSet rs = MySQL.getConnection().createStatement().executeQuery("SELECT * FROM login WHERE name = " + player.getName().toLowerCase());
126 |	   if(rs.next()){
127 |			if(player.getClientId() == Long.parseLong(rs.getString("cid")) && player.getAddress() == rs.getString("ip")){
128 |			   return true;
129 |			}
130 |	   }
131 |		return false;
132 |   }
 

fromgate

Administrator
Something wrong with you query (Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'jackboyplay' in 'where clause').
I recommend you to check your queries using MySQL Workbench or PHP MyAdmin.
 
Top