1
PreparedStatement sql1 = connection.prepareStatement("UPDATE `bantable` " +
"SET reason=?, admin=?, started=?, time=?, ends=?, banned=?, datetimes=? " +
"WHERE DATE_SUB(`datetimes`, NOW())<=0 AND player=?;");
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 'NOW())<=0 AND player='Juustoast''
at line 1
爲什麼它打印錯誤?錯誤在Java中的MySQL語法
首先,要符合你的''''。不要只是在你喜歡的時候使用它們。此外,['NOW()'不是'INTERVAL'。](http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-sub) –