[ticket/11201] Inject table names rather then using constants

PHPBB3-11201
[ticket/11201] Cast some variables to integer

PHPBB3-11201
[ticket/11201] Add some commas at the last array entry

PHPBB3-11201