title: How to manage discount percentage for discount code system
body: <p>I am working on one php product selling site.now over here want to implement Discount System.</p>
  
  <p>When anyone purchase any product, after successful payment am sending one mail with one coupon code with discount amount.</p>
  
  <p>Now I am creating code dynamically using create code combination of random string with time-stamp or whatever and saving that in one table in database with discount amount on that code.</p>
  
  <p>we can create code randomly but how to manage discount amount.</p>
  
  <p>I have read <a href="https://stackoverflow.com/questions/7278925/creating-discount-code-system-mysql-php">Creating Discount Code System (MySQL/php)</a></p>
  
  <p>Its for create code but how to manage discount?</p>
  
  <p>we can not create random amount of discount.</p>
  
  <p>Please suggest me how can I specify discount amount for any coupon code.</p>
  
  <p>I want discount amount in percentage.</p>
  
  <p>If any question please comment it, I will update question details asap.</p>
  
  <p>I want any rules for create amount of discount like:</p>
  
  <p>-any user purchasing frequently </p>
  
  <p>-any seasons time</p>
  
  <p>-want to gift or buying in big amount or something</p>
  
  <p><img src="https://i.stack.imgur.com/hjQgZ.png" alt="enter image description here"></p>