Calculation PHP backend problem

Hi there,

am building a project, I have this page where users can buy a token from the site. When buying the token you will have to select the token name from the drop down option that fetched from the database, after selecting a name the price of the selected option will display in the text field, user will input their qualities and the total will auto calculate and display in the input field. I have userbuy, usersell, Token, as my table names In the database, the table name ‘Token’ is where users can buy the tokens from and the table has, Id, NameofToken, Price. In the userbuy table I have Id, TokenName, Amount, Quantity, Totalbuy, Image, Interest. After the user clicks on buy button the system will calculate a 3 percent interest from the Totalbuy for the user and insert it into the Interest column in the table, the order will go through if user has enough fund in his account else displays error of ‘not enough fund’. This is how I want the page backend to work.

Please if you understand my problem, I just need an example working code to follow and do mine. Please any solution

I have already started the working on it but since am an amateur in PHP it’s difficult to get the codes working. So I want a helping hand with a complete functional code based on my description so that I can follow to do mine. I listed the details of the database table to give an idea of what I mean. Thank you

Sponsor our Newsletter | Privacy Policy | Terms of Service