Jump to content

Adding a percentage to user's entry before being saved in the database


Gotharious

Recommended Posts

I'm making a login area for the hotels in a booking system, where they enter their hotels' information, policy, and room rates

but I want to make the room rates when it appears for clients, it appears with a percentage (commission) added to what the Hotel representative will enter

 

So what's better? it should be added in the admin area of the hotels and gets saved in the database with the commission or I should add it in the booking form so the code grab the rate from the database, multiply it by the percentage and echo the result?

Link to comment
Share on other sites

Two thoughts on this.

First:

Since you are going to condition the room_rate string to stop database injection, you might as well add the commission at that time. So add it before insertion.

 

Second:

Your commission could change, room_rates may also, so use two columns; one with the room_rate and the other room_rate + commission.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.