Looks like there are some problems
- You cast the ID into in even though it's already numeric, but bigint
- You select MAX for the ID and you have a + oprator but no value after +
- You don't have FROM keyword in the SELECT statement at all
However, I would choose a completely different approach. Instead of trying to generate the next value for the key column by yourself, let the database do it. You have at least three different options (in no particular order):
Edit:
If you're using My SQL, then use
AUTO_INCREMENT[
^]