Urbanhack Posted February 3, 2011 Share Posted February 3, 2011 Hello Guys.. Some One Can Help Me With This Error: Here Is The Error In Console: And This Is The Java Code: PreparedStatement statement = con.prepareStatement("" + "SELECT" + "characters.charId," + "characters.char_name" + "FROM" + "characters.account_name = accounts.login" +"WHERE" + "characters.onlinetime > 0" + "GROUP BY" + "accounts.lastIP" + "ORDER BY" + "characters.level" + "DESC"); Thx A Lot! Link to comment Share on other sites More sharing options...
0 B1ggBoss Posted February 3, 2011 Share Posted February 3, 2011 use PreparedStatement statement = con.prepareStatement("SELECT charId, char_name FROM characters WHERE account_name = ?"); statement.setString(1, "The_Account_name_goes_here"); Your error is caused because you dont let spaces anywhere, and the mysql engine cannot distinct between commands, columns and parameters Link to comment Share on other sites More sharing options...
0 Urbanhack Posted February 3, 2011 Author Share Posted February 3, 2011 Then.. This Is Right?: PreparedStatement statement = con.prepareStatement("" + "SELECT" + " characters.charId," + " characters.char_name" + " FROM" + " characters.account_name = accounts.login" +" WHERE" + " characters.onlinetime > 0" + " GROUP BY" + " accounts.lastIP" + " ORDER BY" + " characters.level" + " DESC"); Link to comment Share on other sites More sharing options...
0 B1ggBoss Posted February 3, 2011 Share Posted February 3, 2011 i still dont understand why you use "string" + "string" + etc... Also, you dont need to specify the table name before the column to call Link to comment Share on other sites More sharing options...
0 Urbanhack Posted February 3, 2011 Author Share Posted February 3, 2011 because this code isn't mine... anyway i solved from myself.. thx you a lot! close this th pls. GL ;) Link to comment Share on other sites More sharing options...
Question
Urbanhack
Hello Guys.. Some One Can Help Me With This Error:
Here Is The Error In Console:
And This Is The Java Code:
Thx A Lot!
Link to comment
Share on other sites
4 answers to this question
Recommended Posts