title: Random String for transaction code
body: <p>I would like to ask, I'm developing a website using PHP and currently looking for a better approach.</p>
  
  <p>I want to generate random string for the transaction code.</p>
  
  <p>For example: Customer purchased a product, there must be transaction code to be generated and store it in database table.</p>
  
  <p>Is it better to use a PHP function to generate this then check if transaction code already exists in database table or should I create a stored procedure that will do this? Which do you think is faster?</p>