As you can see the error it clearly shows you the use of double back-tics emailcode``
Once you have added backtiks in the implode you are adding again in insert query
('.$fields.'
)
change
$fields = '`' . implode('`, `',array_keys($reg_data)) . '`';
to
$fields = implode('`, `',array_keys($reg_data)) ;
Or just use it without bacticks as you have already added using implode
$prep = $this->db->prepare('INSERT INTO `users` ('.$fields.') VALUES (?)');