Gotharious Posted October 16, 2011 Share Posted October 16, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/249227-adding-a-percentage-to-users-entry-before-being-saved-in-the-database/ Share on other sites More sharing options...
sunfighter Posted October 17, 2011 Share Posted October 17, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/249227-adding-a-percentage-to-users-entry-before-being-saved-in-the-database/#findComment-1279970 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.