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?

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.