It\'s probably the tenth time I\'m implementing something like this, and I\'ve never been 100% happy about solutions I came up with.
The reason using mysql table ins