I know it’s old here, but thought I would reply, since this is the number one listing for “create table problem” and I didn’t see the solution posted anywhere else.
This code doesn’t work, because you need backticks around your table name and table columns in your sql query. I can’t even post the correct code here, because the editor keeps stripping them out no matter what I do. I would guess that’s why the solution is so elusive… no one can get it to post. ??
Anyway, backticks are the little apostrophe-looking things all the way to the left hand side of your keyboard on the numbers row… so, it goes…
3… 2… 1… backtick…
Not the squiggly one, which is a tilde… just the apostrophe-looking one. That’s it…
Put those around the quotations around tablename and around the column ids… i.e. id, post_id, etc… and you’ll be good to go.
I banged my head against the wall for a day trying to figure this out… it wasn’t till I stumbled onto an obscure video that the author mentioned this.
I’m not sure why it’s not mentioned in the codex, but it probably should be.
Thanks!!
John