robbins Posted March 3, 2007 Share Posted March 3, 2007 How can I make a php script that uses a mysql database... and when the user adds "points" to a specific section (eg: strength), then it subtracts from they're alotted "total" points and adds the points to the strength section. Like so if i were a member, i had 10 total points, and i could add like 3 to strength and 2 to defense then it would take 5 from my total points, and add 3 to strth and 2 to dfnce... Please let me know how to do this?? multiple querys? Link to comment https://forums.phpfreaks.com/topic/40964-php-sql-user-points-system-help~~~~~/ Share on other sites More sharing options...
steelmanronald06 Posted March 3, 2007 Share Posted March 3, 2007 just a few queries to handle it. Query 1: Update the table to display the new strength they desire Query 2: Select the total points/points left and the number of points they applied to strength, and put those in variables. Do some math here to subtract the applied points from the total and apply that number to a variable. Query 3: Update the table, changing to total points to the new number stored in your math variable! Link to comment https://forums.phpfreaks.com/topic/40964-php-sql-user-points-system-help~~~~~/#findComment-198381 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.