[19:56:48 01/04/18] [ERROR] CMySQLQuery::Execute - (error #1064) 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 'SELECT MAX(`id`) FROM `server_item`+1, 'test', 1, 0, 3, 5, 7, 1, 1, 5, 5, 7)' at line 1 (Query: "INSERT IGNORE INTO `server_item` (`id`, `name`, `type`, `required_level`, `attack`, `maxhp`, `maxmp`, `hp_regeneration`, `mp_regeneration`, `jump`, `speed`, `slots`)VALUES (SELECT MAX(`id`) FROM `server_item`+1, 'test', 1, 0, 3, 5, 7, 1, 1, 5, 5, 7)")
SELECT MAX(`id`) FROM `server_item`+1 |
I mean in your query you put "+1" after "FROM tablename", that's not right. MAX(`id`) is correct for getting highest id, and if you want + 1 just put it right after MAX, not after FROM part.
|
[20:43:22 01/04/18] [ERROR] CMySQLQuery::Execute - (error #1064) 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 'SELECT MAX(`id`) FROM `server_item`, 'test', 1, 0, 3, 5, 7, 1, 1, 5, 5, 7)' at line 1 (Query: "INSERT IGNORE INTO `server_item` (`id`, `name`, `type`, `required_level`, `attack`, `maxhp`, `maxmp`, `hp_regeneration`, `mp_regeneration`, `jump`, `speed`, `slots`)VALUES (SELECT MAX(`id`) FROM `server_item`, 'test', 1, 0, 3, 5, 7, 1, 1, 5, 5, 7)")
Oh, I see. You are trying to insert id via subselecting max id from the table. Well, that's not the way to do it. Is your id column set to `AUTO_INCREMENT`? If yes, then you don't have to pass anything (or pass null to use default value (auto incremented id in this case) if you don't specify which fields you are inserting)
|