So I am currently creating a database for a MMO (Massively mutliplayer online). This database is going to list all of the items (armor, weapon, quests, npcs, e.t.c.) in the game. I currently have it set to where each different category has it's own table within the database. I.e a table for weapons, armor, e.t.c.. The data will be displayed in a table and the name of whatever it is will be a link that will take the person to a detailed page about whatever they clicked on.
For every table I have a ID field, that auto increments so each row has it's own ID. But since I have multiple different tables the ids are going to overlap. This isn't acceptable because of how the links work. I created a 2nd field called "identifier" and the default value is based on each table. So the default value for this column in the armor table is "armor".
I then created a third field called "combined", now here's the hard part! I created a trigger where before data is inserted into the table, the trigger combines the "id" field and the "identifier" field using CONCAT and puts it in the field combined. Thus creating a unique id no matter how many tables I have. But, since the ID field auto increments, the trigger is just putting a 0 where a different number should be. Here is the trigger code:
set new.combined = concat(new.id, new.identifier)
This is before insert.
I tried doing a after insert but kept getting an error. I've searched through questions here and can't find an answer for my problem. Any help?